|
Boost Users : |
From: Austin Bingham (austin.bingham_at_[hidden])
Date: 2005-02-24 09:15:14
> Something strange. What is the type of the 'position' option? Unless it's
> std::vector of something, I'd expect an exception to be thrown.
>
> The solution to your problem is the overload the 'validate' function for
> your class. Like this:
>
> void validate(boost::any& v,
> const std::vector<std::string>& xs,
> your_type*, int)
Based on this, I've got a partially working solution. I treat
--position as a vector<string> for parsing purposes; later, when I
populate the runtime object with the parsed values, I make sure the
count() of "position" is 2. While this is a bit problematic, it will
work for the most part.
Ideally, I would be able to specify that each "--position" token on
the command line must be followed by exactly two other tokens. My
validate function would then be able to determine if those strings are
valid.
I'm just waving my hands a bit here, but I don't see any reason why
this couldn't be done. Anyhow, like I said, this would be nice but I
can get by without it.
Austin
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