MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / array_range_based_for_loop

Function array_range_based_for_loop

examples/src/array_examples.cpp:138–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138void array_range_based_for_loop()
139{
140 json book1;
141 book1["category"] = "Fiction";
142 book1["title"] = "A Wild Sheep Chase: A Novel";
143 book1["author"] = "Haruki Murakami";
144
145 json book2;
146 book2["category"] = "History";
147 book2["title"] = "Charlie Wilson's War";
148 book2["author"] = "George Crile";
149
150 json book3;
151 book3["category"] = "Fiction";
152 book3["title"] = "Kafka on the Shore";
153 book3["author"] = "Haruki Murakami";
154
155 // Constructing a json array with an initializer-list
156 json booklist(json_array_arg, {book1, book2, book3});
157
158 for (const auto& book: booklist.array_range())
159 {
160 std::cout << book["title"].as<std::string>() << '\n';
161 }
162}
163
164void make_1_dimensional_array_1()
165{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected