テンプレート化されたクラスのメソッドを実行する関数を書きたいのですが、クラスにない場合でも正常にコンパイルする必要があります。その場合、関数を呼び出さないでください。
struct A
{
void func() {}
};
struct B
{
};
template <typename T>
void anotherFunc(T t)
{
//do t.func() here if T implements func, just do nothing if it doesn't.
}
これはどういうわけか可能ですか?