Skip to content

Commit

Permalink
Remove unnecessary const and &
Browse files Browse the repository at this point in the history
  • Loading branch information
iFreilicht committed Mar 27, 2024
1 parent 1be105c commit cdb7da0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,26 @@ int main()
{"value", 42.99}
}}
};
const auto & object = getObject(valueAt(j2, "object"));

auto object = getObject(valueAt(j2, "object"));

std::cout << "object" << '\n';
std::cout << object << '\n';

const auto & nestedObject = getString(valueAt(object, "currency"));
auto nestedObject = getString(valueAt(object, "currency"));

std::cout << "nestedObject" << '\n';
// This works
std::cout << nestedObject << '\n';

// ------------------------------------------------------------------

const auto & objectRef = getObjectRef(valueAt(j2, "object"));
auto & objectRef = getObjectRef(valueAt(j2, "object"));

std::cout << "objectRef" << '\n';
std::cout << objectRef << '\n';

const auto & nestedObjectRef = getStringRef(valueAt(objectRef, "currency"));
auto & nestedObjectRef = getStringRef(valueAt(objectRef, "currency"));

std::cout << "nestedObjectRef" << '\n';
// Here `nestedObject` seems to be empty.
Expand Down

0 comments on commit cdb7da0

Please sign in to comment.