Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-11-20 15:27:23


Christopher Currie wrote:
> Peter Dimov wrote:
>> Apparently the Sun
>> compiler cannot handle pointers to data members well, selecting the
>> general overload instead. This would correspond to:
>>
>> template<class F> void bind(F f);
>> template<class R, class T> void f(R T::* pm);
>>
>> struct X { int i; };
>>
>> int main() { f(&X::i); }
>>
>> Unfortunately I don't have access to this compiler so I cannot test
>> my theory. ;-)
>
> Did you intend for the two template functions to have different names?

Oops. 'fcourse I didn't. Both should have the same name, and the compiler
should choose the R T::* pm version:

template<class F> void bind(F f);
template<class R, class T> void bind(R T::* pm) {}

struct X { int i; };

int main() { bind(&X::i); }

If it chooses bind(F f) and fails to link, then that's another bug, one that
we can "work around" by disabling data member pointer support on Sun CC. I'm
not sure that we need a new macro, though, this seems pretty Sun-specific.


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