allow_unregistered improvement
po::variables_map vm;
po::parsed_options parsed = po::command_line_parser(argc, argv).options(cmdline_options).allow_unregistered().run();
po::remove_unrecognized(parsed);
po::store(parsed, vm);
namespace boost
{
namespace program_options
{
template <class T> bool is_unrecognized ( T &value ) {
return value.unregistered;
}
template <class T> void remove_unrecognized_options(T &op)
{
T::iterator end=std::remove_if(op.begin(),op.end(),is_unrecognized<T::value_type>);
op.erase(end,op.end());
}
template <class T> void remove_unrecognized(T &op)
{
remove_unrecognized_options(op.options);
}
}
}
Change History
(3)
Component: |
functional → program_options
|
Severity: |
→ Showstopper
|
Owner: |
changed from mark_rodgers to Vladimir Prus
|
Status: |
assigned → new
|
Resolution: |
None → worksforme
|
Status: |
new → closed
|
I do not think this is now necessary, given that 'store' ignores unrecognized options itself.