|
Boost : |
From: Chris Weed (chrisweed_at_[hidden])
Date: 2006-01-11 11:48:22
Hi,
I made a custom validator for filesystem::path and that works, but I
can't seem to get the same to work for std::vector<filesystem::path>.
I keep getting an exception about multiple_occurrences when I use it.
Here is the code for the validator:
void validate(boost::any& v,
const std::vector<std::string>& values,
std::vector<boost::filesystem::path>* target_type, int)
{
using namespace boost::program_options;
// Make sure no previous assignment to 'v' was made.
validators::check_first_occurrence(v);
std::vector<boost::filesystem::path> result;
for(size_t i=0;i<values.size();++i)
{
result.push_back(boost::filesystem::path(values[i]));
}
v = boost::any(result);
}
Thanks,
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk