📝 more documentation for the new exceptions
This commit is contained in:
parent
1ab580d6e9
commit
0f6b8aa718
11 changed files with 89 additions and 23 deletions
|
|
@ -20,4 +20,14 @@ int main()
|
|||
std::cout << j.at("/array"_json_pointer) << '\n';
|
||||
// output element with JSON pointer "/array/1"
|
||||
std::cout << j.at("/array/1"_json_pointer) << '\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';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue