mirror of
https://github.com/nlohmann/json.git
synced 2025-07-16 18:41:53 +03:00
Add operator<<(json_pointer) (#3601)
* Add operator<< for json_pointer * Deprecate json_pointer::operator string_t() * Update documentation * Move operator<<(basic_json) example * Add example * Add mkdocs-redirects * Move operator<< and operator>> doc pages out of basic_json/ * Rename JSON pointer operator_string to operator_string_t * Add unit test
This commit is contained in:
committed by
GitHub
parent
7777300442
commit
e3095f636f
19
docs/examples/json_pointer__operator_string_t.cpp
Normal file
19
docs/examples/json_pointer__operator_string_t.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
int main()
|
||||
{
|
||||
// different JSON Pointers
|
||||
json::json_pointer ptr1("/foo/0");
|
||||
json::json_pointer ptr2("/a~1b");
|
||||
|
||||
// implicit conversion to string
|
||||
std::string s;
|
||||
s += ptr1;
|
||||
s += "\n";
|
||||
s += ptr2;
|
||||
|
||||
std::cout << s << std::endl;
|
||||
}
|
Reference in New Issue
Block a user