]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/examples/get__PointerType.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / nlohmann-json / doc / examples / get__PointerType.cpp
CommitLineData
1e59de90
TL
1#include <iostream>
2#include <nlohmann/json.hpp>
3
4using json = nlohmann::json;
5
6int main()
7{
8 // create a JSON number
9 json value = 17;
10
11 // explicitly getting pointers
12 auto p1 = value.get<const json::number_integer_t*>();
13 auto p2 = value.get<json::number_integer_t*>();
14 auto p3 = value.get<json::number_integer_t* const>();
15 auto p4 = value.get<const json::number_integer_t* const>();
16 auto p5 = value.get<json::number_float_t*>();
17
18 // print the pointees
19 std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n';
20 std::cout << std::boolalpha << (p5 == nullptr) << '\n';
21}