Boost logo

Boost Users :

From: Kobi Cohen-Arazi (kobi.cohenarazi_at_[hidden])
Date: 2006-05-12 12:21:40


Works like a charm. Thanks!

Kobi.

On 5/12/06, François Duranleau <duranlef_at_[hidden]> wrote:
>
> On Fri, 12 May 2006, Kobi Cohen-Arazi wrote:
>
> > Hi,
> >
> > boost-1.32.0-6
> >
> > I've tried to find in the program_options docs how to specify a regular
> > boolean switch. If I use <bool>, it still demand putting something
> >
> > That's what I would like to have
> > ./prog -t
> >
> > and not
> > ./prog -t1
> >
> > Right now, when using <bool> it will throw an exception if I'm not using
> the
> > -t1 notation.
> >
> > Am I missing here something?
>
> Use zero_tokens(), e.g.:
>
> namespace po = ::boost::program_options ;
>
> bool the_flag ;
>
> po::options_description opts( "Options" ) ;
>
> opts.add_options()( "the-flag,t" , po::value( &the_flag )->zero_tokens() )
> //...
> ;
>
> --
> François Duranleau
> LIGUM, Université de Montréal
>
> "There are as many truths as there are people."
> - from _Neon Genesis
> Evangelion_
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>



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