Boost logo

Boost Users :

Subject: Re: [Boost-users] [phoenix] binding member_functions
From: Joel de Guzman (joel_at_[hidden])
Date: 2008-11-10 20:37:51

Christian Henning wrote:
> Hi there, I think there are some problems with binding functions if
> the class has a const and a non-const version of the same member.
> Please consider the following code:


No, it's not a bug. When you get the address of a member function,
there is relly no way in C++ to know which overload you want to
get. You have to state it explicitly with a cast.

The same thing happens with Boost.Bind, for example, try:

    point const p;
    double x = boost::bind( &point::prob, _1 )(p);

and you'll get the exact same error. The Boost Bind docs has a good
explanation on this. See "Binding an overloaded function" here:


Joel de Guzman

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at