1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-06 06:42:33 +03:00

🚚 move byte container outside detail namespace

This commit is contained in:
Niels Lohmann
2020-05-19 13:08:18 +02:00
parent 79347b484b
commit 952a87a4f4
5 changed files with 264 additions and 226 deletions

View 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';
}