Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-07-01 08:37:02

David Abrahams wrote:
> Daniel Frey <daniel.frey_at_[hidden]> writes:
> Not unless you make it generic:
> template< typename T > void reset( T& t )
> {
> using std::swap;
> T x;
> swap(x, t);
> }

It depends on whether or not we expect users to provide swap() as a
member function or as a free function for their own classes. I tried to
address this topic earlier here:


but got no satisfying answer. In fact I would prefer the above generic
version, but it's not generic when UDTs provide a member function swap
and std::swap kicks in and produces inefficient code.

Regards, Daniel

Daniel Frey
aixigo AG - financial solutions & technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web:

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