|
Boost Users : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-01-09 04:45:43
Hi Vsevolod,
> If an option is not specified in my_options, the call
> boost::program_options::store() above throws exception
> "unknown option". (I checked that it is store() that
> throws.)
>
> Does anyone have any suggestions how I could store and
> access the option values in this case? Of course, I
> can use basic_parsed_options returned by run(), but it
> seems to defeat the convenience of the library. Is
> there any way to use store() and variables_map in this
> case?
I'm afraid no, in 1.33.1. I was assuming that with unregistered option, user
has to do some manual word with basic_parsed_options object anyway (like
pass unregistered options to some other part of the program), so did not
paid attention to "store".
Now that you bring it up, it seems reasonable to ignore unregistered options
in "store". A change and a testcase to that effect are just committed.
If you don't want to use CVS version, you can just add
if (options.options[i].unregistered)
continue;
to the loop in the store function.
HTH,
Volodya
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net