The following code shows an example for the copy constructor.
2 #include <nlohmann/json.hpp>
9 json j1 = {
"one",
"two", 3, 4.5,
false};
15 std::cout << j1 <<
" = " << j2 <<
'\n';
16 std::cout << std::boolalpha << (j1 == j2) <<
'\n';
Output (play with this example online): ["one","two",3,4.5,false] = ["one","two",3,4.5,false]
true
The example code above can be translated withg++ -std=c++11 -Isingle_include doc/examples/basic_json__basic_json.cpp -o basic_json__basic_json