All pastes #576731 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-19 16:20 UTC
rendered paste body
#include "stdafx.h"
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/algorithm.hpp>
#include <boost/lambda/bind.hpp>
#include <vector>
#include <algorithm>

using namespace boost::lambda;

struct _functor
{
	int operator()(int i){ return i+1; }
};


int _tmain(int argc, _TCHAR* argv[])
{

	std::vector<int> v1(50);
	std::vector<int> v2(50);


	std::for_each(v1.begin(), v1.end(), _1 = 1 );

	std::transform(v1.begin(), v1.end(), v2.begin(),bind<int>(_functor(), _1));

	return 0;
}