Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-25 05:02:43

Jonathan Graehl wrote:

> I grepped through the program_options source and couldn't find anything
> about declaratively specifying required options (or even more
> specifically, min/max # of occurrences), except for positional options.

Does "min/max" number of occurrences makes much sense? In variables_map, an
option is either present, or not, it cannot be present twice.

> I know it's possible to do variables_map::count("option-name") or if I
> have an impossible default value bound to an option, I could check for
> that (default would = option absence), but it might be nice to have
> "requiredness" be a declared option trait, that could show up in the
> option description.
> value<int>(&myoption)->required()

That's something that was requested some time ago, but not yet there. I'll
note your request (really can't implement all this right before release).

I think that for now you'd have to use .count.

- Volodya

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