Boost logo

Boost :

From: Ross Bencina (rossb_at_[hidden])
Date: 2001-06-29 16:04:46


Douglas Gregor <gregod_at_[hidden]> wrote:
> Borland C++ seems to have a bug regarding template argument deduction when
> dealing with function pointers. Consider this:
>
> template<typename T> void set(const T& t);
> int foo(int, int) {};
> // ...
> set(&foo);

I don't have enough context to be sure the following is the problem, but in
this case:

struct x{
int foo(int,int) {};
void z(){ set( &foo ); }
};

with Borland extensions on, Borland C++ treats &foo as a bound "closure__"
to this->foo. You need to say set( &x::foo ) to get a straight member
function pointer. I've never been sure how ANSI compliant that was..

De-lurkingly yours,

Ross.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk