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