原文地址:http://www.cnblogs.com/haichang/archive/2010/10/22/1857974.html
02 |
#include <boost/bind.hpp> |
03 |
#include <boost/function.hpp> |
10 |
std::cout<<"test"<<std::endl;
|
14 |
std::cout<<"test1:"<<i<<std::endl;
|
16 |
void test2(int a,int b)
|
18 |
std::cout<<"test2:a:"<<a<<" b:"<<b<<std::endl;
|
24 |
boost::function<void()> f1;
|
25 |
f1 = boost::bind(&Test::test, &t);
|
28 |
f1 = boost::bind(&Test::test1, &t, 2);
|
31 |
boost::function<void(int)> f2;
|
32 |
f2 = boost::bind(&Test::test1,&t,_1);
|
35 |
boost::function<void(Test*)> f3;
|
36 |
f3 = boost::bind(&Test::test1, _1,4);
|
39 |
boost::bind(&Test::test2, _1,5,6)(&t);
|
40 |
boost::bind(&Test::test2, &t,_1,8)(7);
|
41 |
boost::bind(&Test::test2, &t,_1,_2)(9,10);
|
42 |
boost::bind(&Test::test2, &t,11,_1)(12);
|
完
相关文章:
-
2021-06-17
-
2022-12-23
-
2021-11-18
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2021-09-26