Hi,
I am reading a Boost.lambda example
http://www.awprofessional.com/articl...00651&seqNum=4.
Here is the example:
void demoVector() {
vector<int> myvector;
myvector.push_b ack(1);
myvector.push_b ack(2);
myvector.push_b ack(4);
for_each(myvect or.begin(), myvector.end(),
cout << _1 << '\n'
);
}
My question is how can this compile? the last argument of for_each
takes a UnaryFunction.
how can I just type in " cout << _1 << '\n'" as the last argument of
for_each?
Thank you.