Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::lambda::bind - how to address the member variable in the expression?
From: Boris Schaeling (boris_at_[hidden])
Date: 2010-05-20 12:30:09


On Thu, 20 May 2010 12:41:37 +0200, Archie14 <admin_at_[hidden]>
wrote:

> Example:
>
> struct A
> {
> int i;
> };
>
> class C
> {
> public:
> void store(int i);
> };
>
>
> boost::ptr_vector<A> lst;
> C c;
>
> std::for_each (lst.begin(), lst.end(),
> boost::lambda::bind(&C::store, c, boost::lambda::_1.i));

std::for_each(lst.begin(), lst.end(),
   boost::lambda::bind(&C::store, boost::ref(c),
     boost::lambda::bind(&A::i, 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