关于lambda表达式
用vs2010写的
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
class lambdatest
{
public:
int copy_();
private:
vector<string> temp2;
};
int lambdatest::copy_()
{
string _temp1[7]={"bgd_movie/bgd","bgd_zj/bgd","bgd_interact/bgd","toolbar/bgd","toolbar/bgd/Preferential","toolbar/bgd/Help","toolbar/bgd/Cooperation"};
vector<string> temp1(_temp1,_temp1+7);
//vector<string> temp2;
for_each(temp1.begin(),temp1.end(),[=,&(this->temp2)](string n)
{
temp2.push_back(n);
});
return 1;
}
int main()
{
lambdatest a;
return 1;
}