次のコードは、次のファンクターオブジェクトを作成する行でエラーをスローしますTest::fun2
。
#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
using namespace boost;
class Test
{
public:
float fun1() { return 0.0f; }
void fun2( float x ) {}
};
int main( int argc, char* argv[] )
{
shared_ptr<Test> p = shared_ptr<Test>( new Test );
function<float(void)> f1 = bind( &Test::fun1, p );
function<void(float)> f2 = bind( &Test::fun2, p );
return 1;
}
コンパイラは私に一連のテンプレートエラーと
`void (Test::*)(float)' is not a class, struct, or union type
これが主なエラーのようです。それにもかかわらず、私はここで何が問題であり、それをどのように解決するのか分かりません。