私は持っている
template <void (*T)(Entity *), typename Caller>
class Updater
{
public:
Updater(Caller c):m_caller(c){}
void process(Entity * e)
{
(m_caller->*T)(e); //Is this right?
}
private:
Caller m_caller;
};
私はそれを次のようにインスタンス化できることを理解しています
Foo f;
Updater<&Foo::Bar> updater(&f);
持っていると仮定しFoo
て
void Foo::Bar(Entity *e);
しかし、必要なメソッドがテンプレート化されている場合はどうなりますか? このような
template <typename T>
void Bar(T t);
どのようにインスタンス化する必要がありますか? このような:?
Foo f;
Updater<&Foo::Bar<Entity *>> updater(&f);
実際のコードでこれを行うと、
invalid template argument for ..., expected compile-time constant expression
だから2つの質問:
1、(m_caller->*T)(e);
正しいですか?そうでない場合、私はそれをどのように呼びますか?
2、どうすればインスタンス化できますか?