JSON for Modern C++ 3.8.0

back
basic_json
empty
json_pointer
operator std::string
operator!=
operator/
operator/
operator/
operator/=
operator/=
operator/=
operator==
parent_pointer
pop_back
push_back
push_back
to_string
| ## ◆ empty() template<typename BasicJsonType >
bool nlohmann::json_pointer< BasicJsonType >::empty | ( |  | ) | const
| inline noexcept
  Returns true iff the JSON pointer points to the root document Complexity Constant. Exception safety No-throw guarantee: this function never throws exceptions. Example The example shows the result of `empty` for different JSON Pointers. 1 #include <iostream> 2 #include <nlohmann/json.hpp> 3 4 using json = nlohmann::json; 5 6 int main() 7 { 8 // different JSON Pointers 9 json::json_pointer ptr0; 10 json::json_pointer ptr1(""); 11 json::json_pointer ptr2("/foo"); 12 json::json_pointer ptr3("/foo/0"); 13 14 // call empty() 15 std::cout << std::boolalpha 16 << ptr0 << ": " << ptr0.empty() << '\n' 17 << ptr1 << ": " << ptr1.empty() << '\n' 18 << ptr2 << ": " << ptr2.empty() << '\n' 19 << ptr3 << ": " << ptr3.empty() << std::endl; 20 } Output (play with this example online):
      "": true
      "": true
      "/foo": false
      "/foo/0": false
  The example code above can be translated with
      g++ -std=c++11 -Isingle_include doc/examples/json_pointer__empty.cpp -o json_pointer__empty
Since version 3.6.0 Definition at line 11853 of file json.hpp.

nlohmann::basic_json::json_pointer
::nlohmann::json_pointer< basic_json > json_pointer
JSON Pointer, see nlohmann::json_pointer.
Definition: json.hpp:16616
nlohmann::json
basic_json<> json
default JSON class
Definition: json.hpp:2933