2010-11-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Added SharedHandle::swap
	* src/SharedHandle.h
This commit is contained in:
Tatsuhiro Tsujikawa 2010-11-15 12:02:10 +00:00
parent e16844cc8f
commit de8598b63a
2 changed files with 17 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2010-11-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added SharedHandle::swap
* src/SharedHandle.h
2010-11-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use --max-connection-per-server option value for Metalink.

View File

@ -37,6 +37,7 @@
#include <cassert>
#include <iosfwd>
#include <algorithm>
// To Use std::tr1::shared_ptr uncomment following few lines and
// comment out SharedHandle stuff.
@ -120,6 +121,11 @@ public:
}
inline size_t getRefCount() const { return refCount_->getStrongRefCount(); }
void swap(SharedCount& r)
{
std::swap(refCount_, r.refCount_);
}
};
class WeakCount {
@ -273,6 +279,12 @@ public:
void reset(T* t) {
*this = SharedHandle(t);
}
void swap(SharedHandle& other)
{
std::swap(obj_, other.obj_);
ucount_.swap(other.ucount_);
}
};
template<typename T, typename S>