Feedback

Lambda expressions

Sprache: C++

Zeigt ein sehr einfaches Beispiel der verwendung der Boost Lambda Library Mehr Informationen: - http://www.research.att.com/~bs/N1968-lambda-expressions.pdf - http://www.boost.org
#include <iostream>
#include <vector>
#include <algorithm>

#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>

using namespace std;
using namespace boost::lambda;

void main()
{
	vector<int> MyCollection(10);

	for_each(MyCollection.begin(), MyCollection.end(), _1 = 4 );

	for_each(MyCollection.begin(), MyCollection.end(), cout << _1 << 'n');

	system("pause");
}
#include <iostream>
#include <vector>
#include <algorithm>

#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>

using namespace std;
using namespace boost::lambda;

void main()
{
	vector<int> MyCollection(10);

	for_each(MyCollection.begin(), MyCollection.end(), _1 = 4 );

	for_each(MyCollection.begin(), MyCollection.end(), cout << _1 << 'n');

	system("pause");
}