When using boost::program_options, how does one set the name of the argument?

后端 未结 6 1756
借酒劲吻你
借酒劲吻你 2021-02-01 18:02

When using boost::program_options, how do I set the name of an argument for boost::program_options::value<>()?

#include 

        
6条回答
  •  孤独总比滥情好
    2021-02-01 18:51

    In recent versions of Boost (only tested for >= 1.61) this is fully supported. Below a slight modification of the first example in the tutorial, where "LEVEL" is printed instead of "arg":

    po::options_description desc("Allowed options");
    desc.add_options()
        ("help", "produce help message")
        ("compression", po::value()->value_name("LEVEL"), "set compression level")
    ;
    

    Live Example

提交回复
热议问题