You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
377 B

  1. #include <json.hpp>
  2. using json = nlohmann::json;
  3. int main()
  4. {
  5. // create an array value
  6. json array = {1, 2, 3, 4, 5};
  7. // get an iterator to the reverse-end
  8. json::reverse_iterator it = array.rend();
  9. // increment the iterator to point to the first element
  10. --it;
  11. // serialize the element that the iterator points to
  12. std::cout << *it << '\n';
  13. }