program_options config_file questions

I'm trying to load a bunch of information out of a file, and I see that with boost::program_options 1.35.0, there's a way to pass a parameter to parse_config_file() to tell it to read in unknown "options". I am doing this, but with a config file as such: [tale] name = bob name = Jerry value = 7 I get back three options, each of which is a vector<> with only one value. Is there a way to get program_options to return tale.name as a single option with two values in the vector? I would assume so, otherwise it seems odd to have it implemented as a vector. I'm sure I must've missed something somewhere to enable that behavior, but would appreciate any pointers. Thanks. - Chris

Chris Ross wrote:
I'm trying to load a bunch of information out of a file, and I see that with boost::program_options 1.35.0, there's a way to pass a parameter to parse_config_file() to tell it to read in unknown "options". I am doing this, but with a config file as such:
[tale] name = bob name = Jerry value = 7
I get back three options, each of which is a vector<> with only one value. Is there a way to get program_options to return tale.name as a single option with two values in the vector?
No. parse_config_file is concerned with syntax only, and three options is what the file contains, syntactically. It's easy to write custom code to merge values of options with the same name. - Volodya
participants (2)
-
Chris Ross
-
Vladimir Prus