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 this:
vgl_point_3d<double> Point; desc.add_options() ("point,p", po::value
(&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? - Volodya