mirror of
https://github.com/aria2/aria2.git
synced 2025-01-04 09:03:46 +00:00
2010-11-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added SharedHandle::swap * src/SharedHandle.h
This commit is contained in:
parent
e16844cc8f
commit
de8598b63a
@ -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.
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user