boost bind
#include<boost/bind.hpp>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace boost;
using namespace std;
struct point
{
int x,y;
point(int a=0,int b=0):x(a),y(b){}
void print(){
cout << "(" << x << "," << y << ")\n";
}
};
int main()
{
vector<point> v(10);
//for_each的时候只需要_1就可以了
for_each(v.begin(),v.end(),bind(&point::print,_1));
}
如下面一行程序代码中,
for_each(v.begin(),v.end(),bind(&point::print,_1));
_1代表什么含义,是代表哪个参数