Boostライブラリを使用するprogram_optionsと、プログラムのヘルプを簡単に印刷できます。
boost::program_options::variables_map options;
boost::program_options::options_description optionsDesc;
boost::program_options::positional_options_description positionalOptionsDesc;
//...
if(options.count("help"))
{
cerr << optionsDesc << endl;
}
しかし、どのようにしてからのオプションをpositional_options_descriptionヘルプメッセージに追加しますか?チュートリアルでは、セクションの最後に、そのような設定の出力を見ることができます。
http://www.boost.org/doc/libs/1_52_0/doc/html/program_options/tutorial.html#id2607297
オプションinput-fileはヘルプに印刷されており、定位置です。しかし、私はコードを見ることができません。のように印刷する組み込みの方法はありoptions_descriptionますか、それとも手動で行う必要がありますか?どうやら、<<は機能しませんpositional_options_description。コンパイルエラーは次のとおりです。
error: cannot bind ‘std::ostream {aka std::basic_ostream<char>}’ lvalue to ‘std::basic_ostream<char>&&’