【发布时间】:2016-12-07 20:18:55
【问题描述】:
我正在使用 boost::program_options 库,下面的代码用于创建选项描述并向其中添加选项:
po::options_description opts("SendFile Options");
opts.add_options()("help,h", "Print this help message")
("other,o","This is the other");
我的问题是,哪个 C++ 语言功能允许您在调用 add_options 函数后以括号中包含的重复值的形式直接添加单独的描述?这叫什么,我将如何创建一个以这种方式工作的函数?
【问题讨论】:
-
只需要编写一个返回可调用对象的函数。
-
你可以重载
operator() -
您说的完全正确,没有出现在类似的线程中。仍然是一个有点令人困惑的实现。
标签: c++ boost boost-program-options