Hi Roman Thanks! It works and thanks for Phoenix advice!Mn
Date: Wed, 11 Nov 2009 13:20:26 +0100
From: roman.perepelitsa@gmail.com
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] doubt on lambda expression
2009/11/11 Emanuele Rocci
Hi AllI started playing with boost::lambda and I need some help or some clarification about itor some hint to better understanding how does it work.
I have this piece of code
using namespace boost::lambda;using boost::lambda::var;
int main(int argc, char** argv) { std::vector< int > myList;
myList.push_back(100); myList.push_back(200); int interval = 20;
std::for_each( myList.begin(), myList.end(), (
std::cout << "value: " << _1 << "\n", std::cout << "interval: " << var( interval ) << "\n",
var( interval )++ ));}
Instead of std::cout << "value: " << _1 << "\n",do this
std::cout << constant("value: ") << _1 << "\n",
It's described here: http://www.boost.org/doc/libs/1_40_0/doc/html/lambda/using_library.html#lamb....
By the way, if you are just starting with lambda, it's better to use Boost.Phoenix instead.
Roman Perepelitsa.
_________________________________________________________________
Carica e scarica in un clic. Fino a 25 GB su SkyDrive
http://www.windowslive.it/skyDrive.aspx