什么是关于什么参数依赖查找的好解释?很多人也称它为Koenig Lookup.
我最好知道:
我试图验证命令行输入到我已定义的枚举,但得到编译器错误.我使用Handle复杂选项和Boost的program_options作为例子.
namespace po = boost::program_options;
namespace Length
{
enum UnitType
{
METER,
INCH
};
}
void validate(boost::any& v, const std::vector<std::string>& values, Length::UnitType*, int)
{
Length::UnitType unit;
if (values.size() < 1)
{
throw boost::program_options::validation_error("A unit must be specified");
}
// make sure no previous assignment was made
//po::validators::check_first_occurence(v); // tried this but compiler said it couldn't find it
std::string input = values.at(0);
//const std::string& input = po::validators::get_single_string(values); // tried this but compiler said it couldn't find it
// I'm …Run Code Online (Sandbox Code Playgroud)