Boost logo

Boost :

Subject: Re: [boost] program_options: Support for open-end options
From: ST (smntov_at_[hidden])
Date: 2013-01-15 12:18:16


On Fri, 2012-12-28 at 00:43 +1100, Joshua Boyce wrote:
> On Thu, Dec 27, 2012 at 4:56 AM, ST <smntov_at_[hidden]> wrote:
>
> > Hi,
> >
> > It would be great to implement support for open-end options, something
> > like that:
> >
> > item_1 = 23
> > item_2 = 45
> > ...
> > item_N = 465
> >
> > The idea is to to be able to provide following input:
> >
> > configOptions.add_options()
> > ("item_", value<int>(), "items");
> >
> > now if add_options() sees a key that ends with a "_" it accepts all
> > options with keys that start with item_, no matter what comes after it,
> > and treat all of them as int . Nesting should also be possible - like
> > this: "item_.subitem_.subsubitem_" (item_3.subitem_FOO.subsubitem_34
> > should be a valid option key).
> > I can try to implement it, however only if it will have a chance to be
> > merged into the boost library. Whom should I contact regarding this?

I looked into source code and noticed that there is already something
like I was suggesting just the special character is not "_" but "*".

See (version 1.52):
options_description.cpp Line 87
config_file.cpp Line 43

This feature is not documented!? I didn't try it yet, but seemingly the
only thing that lacks is the ability to provide a map to such an option
that will be auto-populated by PO. Or is it also supported already, just
I don't see it? For now I have to itereate through the variables_map in
order to pick all those options, right?

Volodya - please, tell us what is already there!

ST


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk