
6 Jun
2005
6 Jun
'05
6 p.m.
On Jun 6, 2005, at 12:32 PM, Rafal Dabrowa wrote:
Suppose I have the following structure:
struct xy { int x, y; };
and the following vector:
vector<xy> v(10);
I want to use lambda library for find an item in the table. Let's say, with x member value equal to 10. Something like this doesn't work:
pos = find_if(v.begin(), v.end(), _1.x == 10);
How the above line should be written ?
Operator . is not overloadable, so the above cannot work. The lambda expression should be: bind(&xy::x, _1) == 10 Jaakko