Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-28 10:23:21


Anthony Williams <anthony_w.geo_at_[hidden]> writes:

> The default implementation of swap is generally along the lines of
>
> template<typename T>
> void swap(T& lhs,T& rhs)
> {
> T temp(lhs);
> lhs=rhs;
> rhs=temp;
> }
>
> The initialization of temp creates a genuine copy of the data.

How so? Didn't you say that *i is a reference to a tuple of
references? That makes T a tuple of references, and the
initialization of a tuple of references just copies a bunch of
pointers IIUC.

> The two assignments then use the assignment operator of boost::tuple
> to assign through the references.
>
> Does that make it clearer?

Not yet.

-- 
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