Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-01 11:44:57


Daniel Frey <daniel.frey_at_[hidden]> writes:

> David Abrahams wrote:
>> Daniel Frey <daniel.frey_at_[hidden]> writes:
>>
>>>David Abrahams wrote:
>>>
>>>>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.
>> We (meaning I) expect a free function :-)
>
> Glad to hear that :)) It's just that I was under the impression that
> this is not the generally agreed on consensus here, but this might be
> misinterpretation on my side

I sure hope it is. A member function isn't generic because you
can't use it to swap non-classes.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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