Boost logo

Boost :

Subject: [boost] program_options::store() interface extension
From: ST (smntov_at_[hidden])
Date: 2012-11-14 12:09:40


I need to supply to my app a config file with following entries:

item1 = 123
item2 = 435
item3 = 345
itemN = 562

where N is not known in advance, so there is no way to register such
options. The only way to deal with them is to pass them as unregistered
options and then use collect_unrecognized(). But then dealing with a
vector<string> is not quit convenient. My suggestion is to add an a
storeUnregistered flag to the store() function which will be false by
default, but if set to true, will store all unregistered options with
their values as strings. It will be possible then to check whether an
item was provided like this: vm.count("item1") and cast its value like
this: vm["item1"].as<int>() .
Or is there already a good way to do what I need?

Thank you in advance,

Boost list run by bdawes at, gregod at, cpdaniel at, john at