MCPcopy Create free account
hub / github.com/delfrrr/delaunator-cpp / get_array_points

Function get_array_points

examples/utils.hpp:57–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56template <typename T>
57inline std::vector<T> get_array_points(std::string const& json) {
58 std::vector<T> points;
59 rapidjson::Document document;
60 if(document.Parse(json.c_str()).HasParseError()) {
61 throw std::runtime_error("Cannot parse JSON");
62 }
63 if(!document.IsArray()) {
64 throw std::runtime_error("It's not JSON Array");
65 }
66 points.reserve(static_cast<std::size_t>(document.Size()));
67 for(rapidjson::SizeType i = 0; i < document.Size(); i++) {
68 // points.push_back(document[i].GetDouble());
69 points.push_back(get_json_value<T>(document[i]));
70 }
71 return points;
72}
73
74} // end ns utils

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected