2
boost :: regex_replaceを呼び出すときにカスタム書式関数を呼び出すにはどうすればよいですか?boost regex formatter、カスタム関数の使い方
私のコードは次のとおりです。
template <typename T>
std::string fmt(boost::match_results<T> match) {
auto str = match[1];
if (str == ".") {
return "\".\"";
} else {
return str;
}
}
void __ConvertEscapeChar(std::string& action, std::string regex) {
boost::regex re(regex);
action = boost::regex_replace(action, re, &fmt, boost::regex_constants::match_all);
}
それがエラーを示ししかし、「__fmt用テンプレート引数を推定できませんでした」。 - 実際にISは何ですか?
あなたの関数名は無効です。参照してください[ここ](http://stackoverflow.com/questions/228783/what-using-the-rules-about-using-an-underscore-in-ac-identifier) –
@BenjaminLindley Meh変更...しかし、そのdosen本当に何かを変えてはいけません(本当にローカル関数を識別するための新しいPREfixが必要です)。 – paul23
現在のエラー以外のコードを有効なC++に変更します。 –