I want to set an individual option with the boost::program_options library. The documentation doesn't seem to cover this. The variables_map
structure the library populates inherits a map, so adding the following to my program (seems to) work:
namespace boost {
namespace program_options {
template <typename T>
void set_in_options(variables_map m, const std::string& option_name, const T& value) {
m.insert(std::make_pair(option_name, variable_value(value, false)));
}
void set_in_options(variables_map m, const std::string& option_name) {
m.insert(std::make_pair(option_name, variable_value(true, false)));
}
}
}
But surely the library author has some "right way" to do this?