Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test_boost_json.cpp #282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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