Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-06-06 09:10:27


Neal D. Becker wrote:

> Currently (last I tested) program options when used with variable map will
> set bool options to false even though they were not specified on the
> command
> line. What I'd prefer is that all options be left alone unless they are
> set
> on the command line. I've been bitten by this unexpected behaviour. (I
> set bool option = true, then use
>
> parse_command_line(argc, argv, desc);
> variables_map vm;
> store(opts, vm, desc);
>
> And my bool option winds up set false even though nothing was specified on
> the command line.

Yes, that's true. All bool options implicitly have default value of "false".
In fact, I think this is quite reasonable. Unless some switch is on, it's
off. This saves the user the need to check if option is present.

Could you describe how this behaviour has bitten you? There's probably a
solution already.

- Volodya


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