1 に答える
1
返された関数シグネチャを変更する必要があると思います。T...
それ...
以外の場合は、変数 arglist が空である必要がある場合でも、変数 arglist が必要です。
template<typename RetType, typename... T>
RetType (*findFunction(const std::string& funcName))(T... Ts) const
{
return (RetType (*)(T...))findFunction(funcName);
}
void
次に、型リストになしで呼び出すと、動作するはずです。
const char* (*whatwhat)() = test.findFunction<const char*>(name);
これらの変更により、次の場所でコンパイルされますgcc-4.5.1
:http://ideone.com/UFbut
于 2012-01-18T01:41:17.683 に答える