boost::program_options: how to get the application name?
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)))
{}
精彩评论