intrusive_list: satisfy the Swappable concept
This commit is contained in:
parent
2a9fdacc60
commit
226d66dd5b
1 changed files with 19 additions and 0 deletions
|
@ -256,9 +256,28 @@ public:
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exchanges contents of this list with another list instance.
|
||||||
|
* @param other The other list to swap with.
|
||||||
|
*/
|
||||||
|
void swap(IntrusiveList& other) {
|
||||||
|
root.swap(other.root);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<IntrusiveListNode<T>> root = std::make_shared<IntrusiveListNode<T>>();
|
std::shared_ptr<IntrusiveListNode<T>> root = std::make_shared<IntrusiveListNode<T>>();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exchanges contents of an intrusive list with another intrusive list.
|
||||||
|
* @tparam T The type of data being kept track of by the lists.
|
||||||
|
* @param lhs The first list.
|
||||||
|
* @param rhs The second list.
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
void swap(IntrusiveList<T>& lhs, IntrusiveList<T>& rhs) {
|
||||||
|
lhs.swap(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
} // namespace Dynarmic
|
} // namespace Dynarmic
|
||||||
|
|
Loading…
Reference in a new issue