linux下如何使用C++ tr1
#include <iostream>
#include <stdio.h>
#include <tr1/memory> // tr1不能少, tr1目录是在/usr/include/c++/gcc-version/tr1目录
#include <tr1/functional>
using namespace std;
class Person
{
public:
Person(void)
{
}
~Person(void)
{
};
public:
void SayHello()
{
cout << "hello , i am a person. "<<endl;
}
};
int main(int argc, char* argv[])
{
tr1::function<void(void)> SayHelloFunc;
Person person;
SayHelloFunc = tr1::bind(&Person::SayHello,&person); //取地址符号不能少
SayHelloFunc();
getchar();
return 0;
}
获取更多帮主请关注小程序