🚚 move byte container outside detail namespace
This commit is contained in:
parent
79347b484b
commit
952a87a4f4
5 changed files with 264 additions and 226 deletions
doc/examples
20
doc/examples/swap__binary_t.cpp
Normal file
20
doc/examples/swap__binary_t.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create a binary value
|
||||
json value = json::binary_array({1, 2, 3});
|
||||
|
||||
// create a binary_t
|
||||
json::binary_t binary = {{4, 5, 6}};
|
||||
|
||||
// swap the object stored in the JSON value
|
||||
value.swap(binary);
|
||||
|
||||
// output the values
|
||||
std::cout << "value = " << value << '\n';
|
||||
std::cout << "binary = " << json(binary) << '\n';
|
||||
}
|
2
doc/examples/swap__binary_t.output
Normal file
2
doc/examples/swap__binary_t.output
Normal file
|
@ -0,0 +1,2 @@
|
|||
value = {"bytes":[4,5,6],"subtype":null}
|
||||
binary = {"bytes":[1,2,3],"subtype":null}
|
Loading…
Add table
Add a link
Reference in a new issue