Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 1999-09-18 20:12:48

From: Luis Coelho <deepblack_at_[hidden]>
> [If this is not the appropriate way to submit this, I appoligise]

Perfectly appropriate, no apology needed.

> I have used boost's shared_ptr (from smart_ptr) for some time now. There is
> however one function I feel is missing. I have added it in my own header
> and I think other users could benefit from it: a nonthrowing swap.
> I will not dwell into the benefits of this function since they are well
> known to readers of comp.lang.c++.mod.
> I propuse this simple implementation:
> template <typename T>
> void shared_ptr<T>::swap(shared_ptr<T>& other) throw()
> {
> std::swap(px,other.px);
> std::swap(pn,;
> }
> Of course shared_array could also benefit from it.

I had this in an earlier version, but it got dropped on the way to boost,
for no good reason that I can recall. Of course std::swap will work, but
not as efficiently.

Boost list run by bdawes at, gregod at, cpdaniel at, john at