【发布时间】:2013-10-17 09:12:40
【问题描述】:
我正在使用boost::program_options,这个问题只是审美问题。
如何强制std::string 选项(或更好的all 选项)仅使用带有“=”的长格式?
现在,我看到的只是“=”被强制用于我的 int 选项,而字符串没有使用等号:
po::options_description desc("Allowed options");
desc.add_options()
(opt_help, "Show this help message")
(opt_int, po::value<int>()->implicit_value(10), "Set an int")
(opt_str, po::value<std::string>()->implicit_value(std::string()), "Set a string")
;
以上将所有选项显示为--help、--int=4、--str FooBar。我只想要--option=something 形式的选项。
我尝试了一些样式,但没有找到合适的。
干杯!
【问题讨论】:
标签: c++ boost command-line boost-program-options