]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/examples/emplace_back.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / nlohmann-json / doc / examples / emplace_back.cpp
1 #include <iostream>
2 #include <nlohmann/json.hpp>
3
4 using json = nlohmann::json;
5
6 int main()
7 {
8 // create JSON values
9 json array = {1, 2, 3, 4, 5};
10 json null;
11
12 // print values
13 std::cout << array << '\n';
14 std::cout << null << '\n';
15
16 // add values
17 array.emplace_back(6);
18 null.emplace_back("first");
19 null.emplace_back(3, "second");
20
21 // print values
22 std::cout << array << '\n';
23 std::cout << null << '\n';
24 }