Boost logo

Boost Users :

Subject: Re: [Boost-users] [program_options] positional options starting with a '-' sign
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-07-23 01:44:07


Ian McCulloch wrote:

>
> Hi,
>
> I have an app using program_options, which has various optional arguments,
> followed by any number of floating point numbers, which are read as
> positional options.
>
> A user just pointed out that it fails with an 'unknown option -0' error if
> any of those positional options are negative, because it tries to interpret
> a number like "-0.34" as an option.
>
> Is there a way to treat unregistered options as positional arguments?
> allow_unregistered() doesn't quite do it - it doesn't give an error anymore
> but neither does it treat "-0.34" as a positional option (even if it is not
> the first positional argument).

This is not presently possible -- and would make for a bad error reporting.
It's possible to use -- to terminate the list of options. Everything thereafter
will be taken as positional option.

- Volodya


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