get_ptr.cpp
Go to the documentation of this file.
00001 #include <json.hpp>
00002 
00003 using json = nlohmann::json;
00004 
00005 int main()
00006 {
00007     // create a JSON number
00008     json value = 17;
00009 
00010     // explicitly getting pointers
00011     auto p1 = value.get_ptr<const json::number_integer_t*>();
00012     auto p2 = value.get_ptr<json::number_integer_t*>();
00013     auto p3 = value.get_ptr<json::number_integer_t* const>();
00014     auto p4 = value.get_ptr<const json::number_integer_t* const>();
00015     auto p5 = value.get_ptr<json::number_float_t*>();
00016 
00017     // print the pointees
00018     std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n';
00019     std::cout << std::boolalpha << (p5 == nullptr) << '\n';
00020 }


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:02