cbegin.cpp 343 B

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