Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions json/test_boost_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ string read_file(const string& filename) {
coordinate_t calc(const string& text) {
auto x = 0.0, y = 0.0, z = 0.0;
auto len = 0;

auto jv = boost::json::parse(text);
auto mr = boost::json::monotonic_resource();
auto jv = boost::json::parse(text, &mr);
auto &obj = jv.get_object();
for (auto& v: obj["coordinates"].get_array()) {
for (auto& v: obj.at("coordinates").get_array()) {
len += 1;
auto& coord = v.get_object();
x += coord["x"].get_double();
y += coord["y"].get_double();
z += coord["z"].get_double();
x += coord.at("x").get_double();
y += coord.at("y").get_double();
z += coord.at("z").get_double();
}

return coordinate_t(x / len, y / len, z / len);
Expand Down