Closed hydexon closed 9 years ago
Thank you for asking hydexon.
When you use the bracket operators, the initial bracket actually returns a map of type std::map (section_t, keys_t). GitHub uses angular brackets, so I substituted parenthesis.
In C++11 to loop through all of the keys in one section:
for(auto j: ini["section"]) { //j.first as key //j.second as Value }
Of course you'd probably want to make sure the section exists before doing this, in-case the section is missing from a file. What I may do is return the keys_t* section upon using ini.select("section"), to not only maintain a result of whether the section exists, but allow you to directly operate on it simply.
Hi, your lib is awesome, but i have an question how do you can iterate the values from ONE section no the whole file itself, i see your example of iterating but only iterates the values and keys from all sections in the file, and only i need iterate from one section, i can make iterate from that code sample simply using an 'if' but the lib will kept iterating until they reach final of the file wasting cpu cycles.
Thanks..