operatorarray__size_type.cpp
Go to the documentation of this file.
00001 #include <json.hpp>
00002 
00003 using json = nlohmann::json;
00004 
00005 int main()
00006 {
00007     // create a JSON array
00008     json array = {1, 2, 3, 4, 5};
00009 
00010     // output element at index 3 (fourth element)
00011     std::cout << array[3] << '\n';
00012 
00013     // change last element to 6
00014     array[array.size() - 1] = 6;
00015 
00016     // output changed array
00017     std::cout << array << '\n';
00018 
00019     // write beyond array limit
00020     array[10] = 11;
00021 
00022     // output changed array
00023     std::cout << array << '\n';
00024 }


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:05