Boost logo

Boost Users :

Subject: Re: [Boost-users] Program options negative arguments
From: David Doria (daviddoria_at_[hidden])
Date: 2009-05-03 16:42:43


>
>
> Use a command line style that does not think '-3' is an option. Multitoken
> options are BAD, exactly because of these ambiguities.
>
> - Volodya
>

Usually what I'm trying to do is input a 3d coordinate. I have tried to do
this:

vgl_point_3d<double> Point;
desc.add_options()
            ("point,p", po::value<vgl_point_3d<double>
>(&Point)->default_value(vgl_point_3d<double>(0.0, 0.0, 0.0)), "set point")

But when I run the program with:
./Test --point 1 2 3

I get:
 what(): in option 'point': invalid option value '1'

(the input operator is properly defined, ie
vgl_point_3d<double> P;
std::cin >> P;

works as expected).

This is why I resorted to a multitoken option. The other option I can think
of is --x 1 --y 2 --z 3, is that what you are recommending?

Thanks,

Dave



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