开发者

boost::program_options: how to get the application name?

开发者 https://www.devze.com 2023-01-29 02:16 出处:网络
Using Boost Program Options, how do you get the string equi开发者_开发技巧valent of argv[0]?I don\'t think this is possible.This may be because the program name could also legally be used as an option

Using Boost Program Options, how do you get the string equi开发者_开发技巧valent of argv[0]?


I don't think this is possible. This may be because the program name could also legally be used as an option name.

The command line parser code explicitly skips the relevant argv member:

template<class charT>
basic_command_line_parser<charT>::
basic_command_line_parser(int argc, charT* argv[])
: detail::cmdline(
    // Explicit template arguments are required by gcc 3.3.1 
    // (at least mingw version), and do no harm on other compilers.
    to_internal(detail::make_vector<charT, charT**>(argv+1, argv+argc+!argc)))
{}
0

精彩评论

暂无评论...
验证码 换一张
取 消