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
19
doc/examples/swap__array_t.cpp
Normal file
19
doc/examples/swap__array_t.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create a JSON value
|
||||
json value = {{"array", {1, 2, 3, 4}}};
|
||||
|
||||
// create an array_t
|
||||
json::array_t array = {"Snap", "Crackle", "Pop"};
|
||||
|
||||
// swap the array stored in the JSON value
|
||||
value["array"].swap(array);
|
||||
|
||||
// output the values
|
||||
std::cout << "value = " << value << '\n';
|
||||
std::cout << "array = " << array << '\n';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue