- 5 名前:デフォルトの名無しさん mailto:sage [2007/09/27(木) 13:14:25 ]
- >>前007
とりあえずこんな感じにすると動いた #include <boost/function.hpp> #include <boost/bind.hpp> #include <windows.h> void g_func(const char* str) { MessageBoxA(NULL, str, "", NULL); } class Cfunc { public: void func(const char* str) { MessageBoxA(NULL, str, "", NULL); } void (Cfunc::* GetFuncPtr()) (const char*) { return &Cfunc::func; } }; class CHolder { public: template <typename T> void set(const T& f) { func = f; } boost::function<void(const char*)> func; }; int main() { CHolder hold; Cfunc cf; hold.set( boost::bind(&Cfunc::func, &cf, _1) ); hold.func("text"); }
|

|