Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
がある場合は、テンプレート パラメーターとしてclass T{ void M() };使用できるテンプレート クラスが必要です。T::M次のように言います。
class T{ void M() };
T::M
T t; TUser<T::M> user(t);
出来ますか?
はい、可能です:
template< typename T, void (T::*M)() > struct something { void somewhere( T* obj ) { (obj->*M)(); } };
そして、次のように使用されます:
T t; something< T, &T::M > user; user.somewhere( &t );