Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-21 20:25:51

Christopher Currie <christopher_at_[hidden]> writes:

> David Abrahams wrote:
>>>struct unspecified {};
>>>template<class R> class bind_t { };
>>>template<class R, class F>
>>> bind_t<R>
>>> bind(F f);
>>>template<class F>
>>> bind_t<unspecified>
>>> bind(F f);
>>>template<class R, class T>
>>> bind_t<R const &>
>>> bind(R T::* pm)
>>> return bind_t<R const &>();
>>>struct X { int i; };
>>>int main() { bind(&X::i); }
>>>The Sun compiler is selecting the first partial specialization over
>>>the second. If I comment out the first specialization, the code
>>>compiles fine, but for some reason it thinks the first is a better
>>>match, so it won't link.
>> These are overloads, not partial specializations, but anyway...
> Right, I forget that you can't specialize functions.

You can, just not partially.

>> what happens if you reverse their order?
> The code seems to compile and link fine if the order is reversed. Is
> this a reasonable workaround for Sun?

"whatever works, man"

> The order shouldn't matter on other compilers, if it's just a
> function overload, although given the large number of bind
> overloads, it could take some time to find the order that works on
> Sun for all cases.

If any such order exists ;-)

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at