mirror of https://github.com/aria2/aria2
2010-11-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added SharedHandle::swap * src/SharedHandle.hpull/1/head
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>
|
2010-11-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Use --max-connection-per-server option value for Metalink.
|
Use --max-connection-per-server option value for Metalink.
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// To Use std::tr1::shared_ptr uncomment following few lines and
|
// To Use std::tr1::shared_ptr uncomment following few lines and
|
||||||
// comment out SharedHandle stuff.
|
// comment out SharedHandle stuff.
|
||||||
|
@ -120,6 +121,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t getRefCount() const { return refCount_->getStrongRefCount(); }
|
inline size_t getRefCount() const { return refCount_->getStrongRefCount(); }
|
||||||
|
|
||||||
|
void swap(SharedCount& r)
|
||||||
|
{
|
||||||
|
std::swap(refCount_, r.refCount_);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class WeakCount {
|
class WeakCount {
|
||||||
|
@ -273,6 +279,12 @@ public:
|
||||||
void reset(T* t) {
|
void reset(T* t) {
|
||||||
*this = SharedHandle(t);
|
*this = SharedHandle(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void swap(SharedHandle& other)
|
||||||
|
{
|
||||||
|
std::swap(obj_, other.obj_);
|
||||||
|
ucount_.swap(other.ucount_);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, typename S>
|
template<typename T, typename S>
|
||||||
|
|
Loading…
Reference in New Issue