Boost logo

Boost Users :

Subject: Re: [Boost-users] [program_options] positional options starting with a '-' sign
From: Ian McCulloch (ianmcc_at_[hidden])
Date: 2009-07-23 02:48:25


Vladimir Prus wrote:

> 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.
>

Ok, I'll just add a note in the documentation to use -- before the
positional arguments. Thanks!

Cheers,
Ian


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