template<typename T> class testClass{
public:
bool compare(const int& a, const int& b){
T x;
....
}
void sort(){
std::sort( data.begin() ,
data.end() ,
boost::bind<bool>(
&testClass<T>::compare,
this, _1 , _2 ) );
}
std::vector<int> data;
}
のコンパレータとして意図された非静的メンバー関数を持つテンプレートクラスがありstd::sortます。コンパレータはtypename Tパラメータによって異なります。暗黙のポインターがあるので、それへのポインターthisを試みます。boost::bindthis
しかし、どちらboost::bind<bool>(.......)もboost::bind(....)コンパイルしません。
上記の例は MSVC 2008 では失敗します (私は英語以外の環境にいるので、英語での正確なメッセージについてはわかりませんが、おそらくどちらかのプロトタイプについて文句を言うと、必要なすべての引数の変換が実行可能になる可能性があります)。