Boost logo

Boost :

From: Dean Sturtevant (deansturtevant_at_[hidden])
Date: 2001-01-22 07:21:44


--- In boost_at_[hidden], "Moore, Paul" <paul.moore_at_u...> wrote:
> From: Dean Sturtevant [mailto:deansturtevant_at_m...]
> > 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
> thread-safety reasons).
>
> It seems fairly likely that this would be the case.
>
Good example (Evidently my imagination isn't rich enough).
- Dean
> Paul.


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