24 Apr
2006
24 Apr
'06
9:51 a.m.
Fran?ois Duranleau wrote:
I wrote a wrapper class that adds options to a list as they are added to program_options, then you can print the list. This is a hack.
Also, another 'hack' is that, looking in the code, you can notice that variables_map inherits from std::map as well (though it's not documented as such). You can thus use standard STL iterators, e.g.
for ( variables_map::iterator i = vm.begin() ; i != vm.end() ; ++ i ) { //... }
The type of values iterated over are pairs of std::string and boost::program_options::variable_value.
I have no idea why BoostBook decided to hide that inheritance, but it was designed that way, so that you can iterate variables_map. I've added comment to that effect to varaibles_map class docs. - Volodya