You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm sorry but I'm completely lost
I just want to iterate over a value:
auto tiles = j.find("tiles");
if (tiles != j.end())
{
for (auto tile : *tiles)
{
std::cout << tile.key() << std::endl;
//printf("Name: %s\n", tile.key().c_str());
}
}
I even used std::cout just like the examples.
{
"tiles":
{
"a": [2, 5],
"b": [3, 0],
What am I doing wrong? It says error: no member named 'key' in tile but that makes no sense because im *iterator so I should already be ranged-for-ing over each tile.
The examples also don't really provide any insight into iterating over things like these.
Iterating over the sub-object and then std::cout << tile << std::endl; works like expected, however that is just magic. I want to print the key and the value separately, one as a string and the other as an array using indexing operator.
The text was updated successfully, but these errors were encountered:
fwsGonzo
changed the title
Iterating over object
Iterating over sub-object
Oct 21, 2017
I'm sorry but I'm completely lost
I just want to iterate over a value:
I even used std::cout just like the examples.
What am I doing wrong? It says
error: no member named 'key' in tile
but that makes no sense because im *iterator so I should already be ranged-for-ing over each tile.The examples also don't really provide any insight into iterating over things like these.
Iterating over the sub-object and then
std::cout << tile << std::endl;
works like expected, however that is just magic. I want to print the key and the value separately, one as a string and the other as an array using indexing operator.The text was updated successfully, but these errors were encountered: