Boost logo

Boost Users :

Subject: [Boost-users] [Boost.Program_options] zero or one tokens with zero_tokens()?
From: Marti Cuquet (cuquet_at_[hidden])
Date: 2009-07-09 10:32:46


Hello,

I am trying to use an option that can have either zero or one arguments.

I have seen an example in the documentation claiming that the following
code would allow the user to provide either zero or one tokens to option
'verbose', but instead it throws an exception "extra parameter" when one
token is given.

So the question is, does zero_tokens() allow the user to specify a value?

options_description desc;
desc.add_options()
    ("help", "produce help message")
    ("compression", value<string>(), "compression level")
    ("verbose", value<string>()->zero_tokens(), "verbosity level")
    ("email", value<string>()->multitoken(), "email to send to")
    ;

Thanks,
Marti


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