2
0

json_pointer__empty.cpp 579 B

1234567891011121314151617181920
  1. #include <iostream>
  2. #include <nlohmann/json.hpp>
  3. using json = nlohmann::json;
  4. int main()
  5. {
  6. // different JSON Pointers
  7. json::json_pointer ptr0;
  8. json::json_pointer ptr1("");
  9. json::json_pointer ptr2("/foo");
  10. json::json_pointer ptr3("/foo/0");
  11. // call empty()
  12. std::cout << std::boolalpha
  13. << "\"" << ptr0 << "\": " << ptr0.empty() << '\n'
  14. << "\"" << ptr1 << "\": " << ptr1.empty() << '\n'
  15. << "\"" << ptr2 << "\": " << ptr2.empty() << '\n'
  16. << "\"" << ptr3 << "\": " << ptr3.empty() << std::endl;
  17. }