Boost logo

Boost Users :

Subject: Re: [Boost-users] Confused with Lambda library usage
From: Boris (boriss_at_[hidden])
Date: 2008-12-13 19:19:43


On Sat, 13 Dec 2008 05:19:07 +0100, QPlace <quiteplace_at_[hidden]> wrote:

> 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<Unit*> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net