Boost logo

Boost Users :

Subject: [Boost-users] Program Options: What would be involved in implementing add_options()(optionNameWork, po::value<std::pair<int, float>>() ?
From: Charles Mills (charlesm_at_[hidden])
Date: 2012-06-29 21:14:57


I really like Boost Program Options.

I came up with this wild hare of being able to handle something like
foo= int float

Obviously, I could do it by instead using
foo_int= int
foo_float= float

But what would be involved in being able to do something like
add_options()(optionNameWork, po::value<std::pair<int, float>>() ?

I would have to derive a class from boost::program_options::value_semantic?
I would have to implement all of the abstract methods?
The other classes also like abstract_variables_map?
Or just variable_value?

Volodya wrote in response to an earlier question "I would imagine this to be
not hard. Either define operator>> for the class you use to represent
rectangles, over override 'validate'"

Is that what I should? Define operator>> for pair<int, float> ? Where is an
example of a boost::program_options >> operator?

Where is validate() declared?

Sorry to be such a newbie at this level of C++ programming. You have to
start somewhere.

Charles


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