9b32f72584
As I learned in https://github.com/melpon/wandbox/issues/209, this library is already installed at Wandbox, so we need to adjust the examples to use `#include "json.hpp"` insteas of `#include <json.hpp>`.
18 lines
377 B
C++
18 lines
377 B
C++
#include "json.hpp"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
int main()
|
|
{
|
|
// create an array value
|
|
json array = {1, 2, 3, 4, 5};
|
|
|
|
// get an iterator to the reverse-end
|
|
json::reverse_iterator it = array.rend();
|
|
|
|
// increment the iterator to point to the first element
|
|
--it;
|
|
|
|
// serialize the element that the iterator points to
|
|
std::cout << *it << '\n';
|
|
}
|