How can I get a list with the indices of my key-value array? #1474
-
I don't know, but I would like a more abundant documentation than the one offered by this repository generated by doxygen. I have this json: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Value has member functions to get you a list of keys. Value is also a C++ range, having begin and end member functions. I think the library already does what you want. You just have to say it in C++ and not JS. Value arr{
{"world_1",{...}},
{"world_2",{...}},
...
};
for (auto&& [k,v] : arr) {
std::cout
<< " " << k << ": "
<< v << std::endl;
} this is very idiomatic C++ container iteration. I think you have to come with some level of experience to use the library. This could be making life a little harder for people don't have or need that basic familiarity to interpret the existing robo-docs. There could be very basic examples like this added to the README.md or something. |
Beta Was this translation helpful? Give feedback.
Value has member functions to get you a list of keys. Value is also a C++ range, having begin and end member functions.
I think the library already does what you want. You just have to say it in C++ and not JS.
this is very idiomatic C++ container iteration. I think you have to come with some level of experience to use the library. This could be making life a little harder for people don't have or need that basic familiarity to interpret the existing robo-docs.
There could be very basic examples like this added to the README.md or something.