Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-09-12 13:19:53

David Abrahams wrote:
>> There are two ways to improve the default definition of std::swap:
>> * Make std::swap(a, b) call a.swap(b) for user-defined types and
>> retain the current semantics for built-in types.
>> This would still require users to explicitly provide the fast,
>> non-throwing swap
> Unlike John's proposal, which falls back to the current swap
> semantics when users don't provide swap.

Indeed. It's still pretty close, though, and my point was that this
suggestion did not receive much attention at the meetings where the paper
has been discussed, or at least that's been my impression. Probably because
we didn't even have is_class<> at our disposal at the time IIRC so we didn't
show an implementation.

John's proposal changes "would still require" to "would allow" in the
sentence above, which is indeed a superior solution.

>> but will eliminate the need to specialize std::swap for every
>> user-defined type. The std::swap overloads for std::vector,
>> std::string, etc. may be removed.

still holds.

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