Boost logo

Boost Users :

Subject: [Boost-users] Lambda issue.
From: Surya Kiran Gullapalli (suryakiran.gullapalli_at_[hidden])
Date: 2009-03-01 06:17:25


Hello all,I've a class with boost::variant as its member ;

class A
{
public:
A() { }

boost::variant<int, string, double, date>& getValue (const string& key)
{
...
}
private:
map<string, boost::variant<int, string, double, date> >m_member ;
}

I've list of A's like this
list<A> myList.
when trying to find a particular element with integer value (1 say) which is
stored in m_member,
I'm doing this..

find_if (myList.begin(), myList.end(),
(boost::lambda::bind(&A::getValue, boost::lambda::_1, "SomeKey") == 1));

This is giving lot of errors. I've tried casting the result of bind to
Variant, and then converting the variant to int using boost::get<int>()..
but no help.

Any ideas how to do this ?

Surya



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