本文整理汇总了C++中nd::array::data方法的典型用法代码示例。如果您正苦于以下问题:C++ array::data方法的具体用法?C++ array::data怎么用?C++ array::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nd::array
的用法示例。
在下文中一共展示了array::data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse_json
void dynd::parse_json(nd::array &out, const char *json_begin, const char *json_end, const eval::eval_context *ectx)
{
try
{
const char *begin = json_begin, *end = json_end;
ndt::type tp = out.get_type();
::parse_json(tp, out.get()->metadata(), out.data(), begin, end, ectx);
begin = skip_whitespace(begin, end);
if (begin != end) {
throw json_parse_error(begin, "unexpected trailing JSON text", tp);
}
}
catch (const json_parse_error &e)
{
stringstream ss;
std::string line_prev, line_cur;
int line, column;
get_error_line_column(json_begin, json_end, e.get_position(), line_prev, line_cur, line, column);
ss << "Error parsing JSON at line " << line << ", column " << column << "\n";
ss << "DyND Type: " << e.get_type() << "\n";
ss << "Message: " << e.what() << "\n";
print_json_parse_error_marker(ss, line_prev, line_cur, line, column);
throw invalid_argument(ss.str());
}
catch (const parse::parse_error &e)
{
stringstream ss;
std::string line_prev, line_cur;
int line, column;
get_error_line_column(json_begin, json_end, e.get_position(), line_prev, line_cur, line, column);
ss << "Error parsing JSON at line " << line << ", column " << column << "\n";
ss << "Message: " << e.what() << "\n";
print_json_parse_error_marker(ss, line_prev, line_cur, line, column);
throw invalid_argument(ss.str());
}
}