I would like to call a member through lambda::bind. Unfortunately I have got two members with the same name but different return types. Is there a way to help the lambda::bind to deduce the right return type for a member function call? (bind works fine with explicit return type deduction)
#include <vector>
#include <iostream>
#include <algorithm>
#include <boost/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
using namespace std;
using namespace boost;
struct A
{
A (const string & name) : m_name(name) {}
string & name () { return m_name; }
const string & name () const { return m_name; }
string m_name;
};
vector<A> av;
int main ()
{
av.push_back (A ("some name"));
// compiles fine
find_if(av.begin(), av.end(), bind<const string &>(&A::name, _1) == "some name");
// error: call of overloaded 'bind(<unresolved overloaded function type>, const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >&)' is ambiguous
find_if(av.begin(), av.end(), lambda::bind(&A::name, lambda::_1) == "some name");
return 0;
}