]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/examples/operator__less.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / nlohmann-json / doc / examples / operator__less.cpp
1 #include <iostream>
2 #include <nlohmann/json.hpp>
3
4 using json = nlohmann::json;
5
6 int main()
7 {
8 // create several JSON values
9 json array_1 = {1, 2, 3};
10 json array_2 = {1, 2, 4};
11 json object_1 = {{"A", "a"}, {"B", "b"}};
12 json object_2 = {{"B", "b"}, {"A", "a"}};
13 json number_1 = 17;
14 json number_2 = 17.0000000000001L;
15 json string_1 = "foo";
16 json string_2 = "bar";
17
18 // output values and comparisons
19 std::cout << std::boolalpha;
20 std::cout << array_1 << " == " << array_2 << " " << (array_1 < array_2) << '\n';
21 std::cout << object_1 << " == " << object_2 << " " << (object_1 < object_2) << '\n';
22 std::cout << number_1 << " == " << number_2 << " " << (number_1 < number_2) << '\n';
23 std::cout << string_1 << " == " << string_2 << " " << (string_1 < string_2) << '\n';
24 }