
Cannot figure out how to properly use lambda library in following situation (pseudo-code below):
class Unit
{
};
class Test
{
public:
void dosmth(Unit* unit) {}
};
int main()
{
vector

----- Original Message -----
From: "QPlace"
Cannot figure out how to properly use lambda library in following situation (pseudo-code below):
class Unit { };
class Test { public: void dosmth(Unit* unit) {} };
int main() { vector
lst; Test t; for_each (lst.begin(), lst.end(), ?// I want to call t.dosmth with each Unit* in list } Any help will be greatly appreciated.
Hi, you can take a look at the documentation Lambda expressions in details > Member functions as targets Best, Vicente

Thank you Vicente, I already did and in spite of existence of the docs I had to ask for a help. All options that I came up with failed to compile. I can post them here, but I thought that for the person who knows Lambda library the answer should be trivial.

----- Original Message -----
From: "QPlace"
Thank you Vicente,
I already did and in spite of existence of the docs I had to ask for a help. All options that I came up with failed to compile. I can post them here, but I thought that for the person who knows Lambda library the answer should be trivial.
Try, we will see. Vicente

On Sat, 13 Dec 2008 05:19:07 +0100, QPlace
Cannot figure out how to properly use lambda library in following situation (pseudo-code below):
class Unit { };
class Test { public: void dosmth(Unit* unit) {} };
int main() { vector
lst; Test t; for_each (lst.begin(), lst.end(), ?// I want to call t.dosmth with each Unit* in list }
for_each(lst.begin(), lst.end(), boost::lambda::bind(&Test::dosmth, boost::ref(t), boost::lambda::_1)); HTH, Boris
participants (3)
-
Boris
-
QPlace
-
vicente.botet