Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2001-01-23 19:14:30

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. / 1 says:
> A program may add template specializations for any standard
> library template to namespace std. Such a specialization
> (complete or partial) of a standard library template results
> in undefined behavior unless the declaration depends on a
> user-defined name of external linkage and unless the specialization
> meets the standard library requirements for the original template.

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.

Here's a message from the middle of that old thread:

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.

At some point I suggest we make the call for how we're going to do this
throughout boost instead of constantly re-considering the issue separately
for each part of the library.

    -- Darin

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