Using bool_switch
, I can write a command line option to turn a flag on:
bool flag;
po::options_description options;
options.add_options()
("on", po::bool_switch(&flag)->default_value(false))
;
Where now ./a.out
will have flag==false
and ./a.out --on
will have flag==true
. But, for the purposes of being explicit, I would additionally like to add a command line option to turn flag off. Something like:
options.add_options()
("on", po::bool_switch(&flag)->default_value(false))
("off", po::anti_bool_switch(&flag)) // ????
;
Is there a way to do anti_bool_switch
in the program_options library, or do I basically have to write a proxy bool reference?