Kiedy używasz boost :: program_options, jak ustawić nazwę argumentu?
Podczas używaniaboost::program_options
, jak ustawić nazwę argumentu dlaboost::program_options::value<>()
?
#include <iostream>
#include <boost/program_options.hpp>
int main()
{
boost::program_options::options_description desc;
desc.add_options()
("width", boost::program_options::value<int>(),
"Give width");
std::cout << desc << std::endl;
return 0;
}
Powyższy kod podaje:
--width arg Give width
Chcę zastąpićarg
nazwa z czymś bardziej opisowymNUM
:
--width NUM Give width