json_pointer__operator__notequal.cpp 645 B

12345678910111213141516171819
  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. // compare JSON pointers
  11. std::cout << std::boolalpha
  12. << "\"" << ptr0 << "\" != \"" << ptr0 << "\": " << (ptr0 != ptr0) << '\n'
  13. << "\"" << ptr0 << "\" != \"" << ptr1 << "\": " << (ptr0 != ptr1) << '\n'
  14. << "\"" << ptr1 << "\" != \"" << ptr2 << "\": " << (ptr1 != ptr2) << '\n'
  15. << "\"" << ptr2 << "\" != \"" << ptr2 << "\": " << (ptr2 != ptr2) << std::endl;
  16. }