IntrusivePtr: overload std::swap()

This commit is contained in:
Max Kellermann 2020-02-25 20:54:58 +01:00
parent 4dbc224e21
commit 5ed69edb7e

View file

@ -118,6 +118,12 @@ public:
std::swap(ptr_, other.ptr_);
}
friend void swap(IntrusivePtr& a, IntrusivePtr &b) noexcept
{
using std::swap;
swap(a.ptr_, b.ptr_);
}
/**
* Detaches an object from the automated lifetime management and sets this
* intrusive pointer to @c nullptr.