mirror of
https://github.com/nlohmann/json.git
synced 2025-07-22 15:21:52 +03:00
📝 more documentation for the new exceptions
This commit is contained in:
@ -32,4 +32,14 @@ int main()
|
||||
j.at("/array/1"_json_pointer) = 21;
|
||||
// output the changed array
|
||||
std::cout << j["array"] << '\n';
|
||||
|
||||
// try to use an invalid JSON pointer
|
||||
try
|
||||
{
|
||||
auto ref = j.at("/number/foo"_json_pointer);
|
||||
}
|
||||
catch (json::out_of_range& e)
|
||||
{
|
||||
std::cout << e.what() << '\n';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user