y‰SŽÒнŒ}zC/C++Ž ..
5:ƒfƒtƒHƒ‹ƒg‚Ì–¼–³‚µ‚³‚ñ
07/09/27 13:14:25
>>‘O007
‚Æ‚è‚ ‚¦‚¸‚±‚ñ‚ÈŠ´‚¶‚É‚·‚邯“®‚¢‚½
#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");
}
ŽŸƒy[ƒW‘±‚«‚ð•\ަ1‚ð•\ަÅVƒŒƒX•\ަƒXƒŒƒbƒh‚ÌŒŸõ—ÞŽ—ƒXƒŒˆê——˜b‘è‚̃jƒ…[ƒX‚¨‚Ü‚©‚¹ƒŠƒXƒg¥ƒIƒvƒVƒ‡ƒ“‚ð•\ަ‰É‚‚Ԃµ2ch
4987“ú‘O‚ÉXV/84 KB
’S“–:undef