mirror of
https://github.com/nlohmann/json.git
synced 2026-07-09 12:05:10 +00:00
a0a4e7cc0b
* Added front, pop_front, and push_front methods to json_pointers in order to facilitate root-to-leaf traversals of JSON object trees. (#4889) Signed-off-by: trdesilva <5818730+trdesilva@users.noreply.github.com> * undid VS autoformatting in irrelevant code Signed-off-by: trdesilva <5818730+trdesilva@users.noreply.github.com> * Ran make amalgamate, added navigation to json_pointer's new front methods in mkdocs, and fixed errors in documented complexity for those methods. Signed-off-by: trdesilva <5818730+trdesilva@users.noreply.github.com> * Fixed GCC 4.8 compile error caused by const iterators Signed-off-by: trdesilva <5818730+trdesilva@users.noreply.github.com> * Fixed another gcc-4.8 compile error Signed-off-by: trdesilva <5818730+trdesilva@users.noreply.github.com> * amalgamated Signed-off-by: trdesilva <5818730+trdesilva@users.noreply.github.com> --------- Signed-off-by: trdesilva <5818730+trdesilva@users.noreply.github.com>
22 lines
422 B
C++
22 lines
422 B
C++
#include <iostream>
|
|
#include <nlohmann/json.hpp>
|
|
|
|
using json = nlohmann::json;
|
|
|
|
int main()
|
|
{
|
|
// create empty JSON Pointer
|
|
json::json_pointer ptr("/foo/bar/baz");
|
|
std::cout << "\"" << ptr << "\"\n";
|
|
|
|
// call pop_front()
|
|
ptr.pop_front();
|
|
std::cout << "\"" << ptr << "\"\n";
|
|
|
|
ptr.pop_front();
|
|
std::cout << "\"" << ptr << "\"\n";
|
|
|
|
ptr.pop_front();
|
|
std::cout << "\"" << ptr << "\"\n";
|
|
}
|