Boost Users :
Subject: Re: [Boost-users] Program options negative arguments
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-05-04 04:55:16
David Doria wrote:
>> 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
> vgl_point_3d<double> Point;
> ("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?
Having --point 1,2,3 would seem reasonable -- I assume your point class has already
operator>> that will parse some representation?
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