|
Boost Users : |
From: David Abrahams (yg-boost-users_at_[hidden])
Date: 2002-09-02 15:17:15
"Duane Murphy" <duanemurphy_at_[hidden]> wrote in message
news:20020902181536.24618_at_mail.murphyslogic.com...
> --- At Mon, 2 Sep 2002 18:48:08 +0100, Alex Henderson wrote:
>
> >Hi,
> >
> >I'd like boost::bind to use overloaded member functions, but get an
> >internal compiler error. Does bind support overload resolution, or is
> >my compiler at fault? (...or more likely the code!)
>
> This seems like a simple ambiguity problem more than overload resolution,
> although overload resolution seems to play a part. All bind() gets is the
> address of a function. If there are more than one function with the same
> name, then AFAIK, there's no syntax for saying which function to use.
>
> The solution that I have used is to not overload, or to have a function
> that is not overloaded that calls the overloaded function, or to have a
> free function that calls the overloaded function.
>
> If there is a syntax for this situation, I would love to know what it is.
There's none. It's beyond the C++ language to express an overload set as a
single object. The best you can do is to write a wrapper functor which uses
overload resolution to dispatch to the right function. It's possible to
generalize this somewhat using the preprocessor, but it ain't pretty.
-Dave
-----------------------------------------------------------
David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com
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