
11 Jan
2006
11 Jan
'06
4:48 p.m.
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