以下のような単純なクラスがあります。
typedef mytype int;
typedef mytype2 float;
class A {
.
.
void run (mytype t) { .... do something with t ..... }
.
.
}
テンプレート関数を作成した別のクラスがあります (クラス A から独立させるため)。この関数は、パラメーターと共に関数ポインター (つまり、クラス A メソッドの実行) を受け取ることになっています。
class B {
.
template< // how it should be defined >
void myfunction ( // how parameters will be passed ) { }
ドライバーは次のようなものでなければなりません
A a
B b
C c
b.myfunction(&A::run, mytype); // Or how it should be called
b.myfunction(&B::run, mytype2); // - do -
アイデア/コード/理由?
よろしく、Farrukh Arshad。