Boost logo

Boost Users :

Subject: [Boost-users] boost::lambda::bind - how to address the member variable in the expression?
From: Archie14 (admin_at_[hidden])
Date: 2010-05-20 06:41:37


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));

Question:
construct boost::lambda::_1.i is invalid. I understand why it is so, but can't
find a way to reference member variable in this case. Any advise or referral
to the specific paragraph in boost::lambda documentation is appreciated.
Thanks.


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