Boost logo

Boost :

From: Dietmar Kuehl (dietmar_kuehl_at_[hidden])
Date: 2000-08-30 17:04:58

Gary Powell wrote:

> > This should work just fine, and I don't think there is a std namespace
> > problem:
> >
> This is the exact same problem I had with swap.
> namespace std {
> template<class T, class S, class R>
> swap(myType<T,S,R>, myType<T,S,R> );
> }

There is a fundamental difference: You are allowed to partially specialize
a template depending on at least one user defined type in namespace std
but you are never allowed to overload a function. Since there is no such
thing as partially specializing a function, only overloading involving
function ordering, it is indeed illegal to provide this 'swap()' method while

it perfectly legal provide teh 'container_gen' specialization (assuming, of
course, that 'container_gen' happens to be standard name).

I'm pretty sure that the rule against overloading will be relexed prior to
next revision of the standard... It is just an error which, unfortunately,
probably does not qualify as a defect (at least I can imagine very well which

library vendor would fight it...).

Do You Yahoo!?
Get your free address at

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