From: Stephen Silver (boost_at_[hidden])
Date: 2001-01-24 16:41:15
Darin Adler wrote:
> on 1/23/01 3:27 PM, Stephen Silver at boost_at_[hidden] wrote:
> > Daryle Walker wrote:
> >> Since we can't put specializations of template functions, like "swap",
> >> in the "std" namespace,
> > But we can. 18.104.22.168 / 1 says:
[snip quote from standard]
> This has been discussed in the past on this list at length. Defining another
> std::swap for a particular type might seem to be a "specialization" at first
> glance, but it is actually an overloaded function, hence not legal.
The std::swap I have for my GMP mpz_t wrapper is like this:
void swap(::Integer& a, ::Integer& b)
This is a specialization, not an overload, and is legal.
> Here's a message from the middle of that old thread:
I've read this thread, and some others on a similar theme, but I don't
see anything contradicting the correctness of specializations like the
one shown above. And I do find some like this:
confirming that such specializations are legal.
> I decided to ignore this issue after adding swap to smart_ptr.hpp, and so
> the std::swap specializations/overloads (I still don't 100% understand
> which) are still there even though they are theoretically illegal.
Those are overloads, so they really are illegal.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk