From: Moore, Paul (paul.moore_at_[hidden])
Date: 2001-01-22 05:19:08
From: Dean Sturtevant [mailto:deansturtevant_at_[hidden]]
> I find it hard to imagine a case where std::swap is more efficient
> than assignment, unless the assignment is coded inefficiently. Can
> you provide an example where that might not be the case?
My thought was a long-integer type where the internal representation was a
(potentially) large array of "digits". The swap operation could be a simple
pointer exchange, whereas assignment would need allocation and copying of a
new digit array. (Assuming reference counting isn't used, possibly for
It seems fairly likely that this would be the case.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk