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:

   <http://lists.boost.org/MailArchives/boost/msg52183.php>

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: http://www.aixigo.de

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk