From 226d66dd5b9db9b48f783571f9db8f2fc63847a5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 21 Aug 2016 06:13:08 -0400 Subject: [PATCH] intrusive_list: satisfy the Swappable concept --- src/common/intrusive_list.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/common/intrusive_list.h b/src/common/intrusive_list.h index 4160d5d8..0b9424fb 100644 --- a/src/common/intrusive_list.h +++ b/src/common/intrusive_list.h @@ -256,9 +256,28 @@ public: 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: std::shared_ptr> root = std::make_shared>(); }; +/** + * 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 +void swap(IntrusiveList& lhs, IntrusiveList& rhs) { + lhs.swap(rhs); +} + } // namespace Common } // namespace Dynarmic