mirror of
https://github.com/nlohmann/json.git
synced 2025-07-16 18:41:53 +03:00
Reorganize directories (#3462)
* 🚚 move files * 🚚 rename doc folder to docs * 🚚 rename test folder to tests
This commit is contained in:
18
docs/examples/swap__reference.cpp
Normal file
18
docs/examples/swap__reference.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
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';
|
||||
}
|
Reference in New Issue
Block a user