Boost logo

Boost :

Subject: Re: [boost] boost::program_options question - enabling multiple usage of the same switch
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2008-10-07 11:06:08


Khaikin, Sergey wrote:

> Hi,
>
> This question was originally brought up here:
>
> http://lists.boost.org/boost-users/2006/08/21633.php
>
> but unfortunately was not answered. What I basically want to do is to
> enable something like running
>
>
>
> $ myprog -v -v -v
>
>
>
> Where -v is some Boolean switch.

Boolean? What would be the semantics of multiple occurences? If you want
integer variable that is incremented by 1 for each occurrence, then I think
this is entirely syntax matter, and probably is best handled by taking
vector<option> returned by parse_command_line, finding all -v occurences,
and merging them into a single option, with a value equal to the number
of occurrences. There is no built-in way to do this.

- Volodya


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