Just found out: if default value is removed from the line: options_description config("Configuration"); config.add_options() ("worker-threads,w", po::value<int>(), , "Each worker thread starts parsing of one file.\ndefault: 20") ; No assertions are produced. There should be some problems with bounds, maybe... Thanks, Ovanes On Wed, August 9, 2006 18:35, Ovanes Markarian wrote:
Hi!
I use MS VC8.0 (2005) Express Edition.
This code sample causes the following assertion:
int main(int argc, char* argv[]) { options_description generic("Generic options"); generic.add_options() ("version,v", "print version string") ("help,h", "produce help message") ;
// Declare a group of options that will be // allowed both on command line and in // config file options_description config("Configuration"); config.add_options() ("worker-threads,w", po::value<int>()->default_value(20), "Each worker thread starts parsing of one file.\ndefault: 20") ;
options_description cmdline_opt, cfgf_opt; cmdline_opt.add(generic).add(config); cfgf_opt.add(config);
variables_map vm; store(command_line_parser(argc, argv).options(cmdline_opt).run(), vm);
ifstream ifs("scanning_options.cfg"); store(parse_config_file(ifs, cfgf_opt), vm); notify(vm);
if(vm.count("help")) cout << config << endl;
//... some other code
return 0; }
In this line: cout << config << endl;