more documentation
In this commit, also the semantics for values skipped via the parser callback has changed. Now, the top-level value is returned as “null” instead of “discarded”.
This commit is contained in:
parent
48545f5b18
commit
457572184c
25 changed files with 856 additions and 60 deletions
17
doc/examples/swap__reference.cpp
Normal file
17
doc/examples/swap__reference.cpp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create two JSON values
|
||||
json j1 = {1, 2, 3, 4, 5};
|
||||
json j2 = {{"pi", 3.141592653589793}, {"e", 2.718281828459045}};
|
||||
|
||||
// swap the values
|
||||
j1.swap(j2);
|
||||
|
||||
// output the values
|
||||
std::cout << "j1 = " << j1 << '\n';
|
||||
std::cout << "j2 = " << j2 << '\n';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue