From 97b364112f0c9f3378011d6567433923f9fd8328 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sat, 17 Jan 2015 15:27:09 +0100 Subject: Managed container does not reset owner on move -- this allows the container to be reusable after a move. Adapted unit test accordingly. --- src/core/managed/ManagedContainer.hpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/core/managed') diff --git a/src/core/managed/ManagedContainer.hpp b/src/core/managed/ManagedContainer.hpp index 067a789..bdab38f 100644 --- a/src/core/managed/ManagedContainer.hpp +++ b/src/core/managed/ManagedContainer.hpp @@ -222,7 +222,7 @@ public: ManagedContainer(std::initializer_list l) : owner(nullptr), c(l) { initialize(); - }; + } /** * Constructor of the ManagedContainer class. @@ -322,7 +322,7 @@ public: ManagedContainer(own_type &&other) : owner(other.owner), c(std::move(other.c)) { - other.owner = nullptr; + //other.owner = nullptr; } /** @@ -338,7 +338,7 @@ public: { initialize(); other.finalize(c); - other.owner = nullptr; + //other.owner = nullptr; } /** @@ -356,7 +356,7 @@ public: { initialize(); other.finalize(c); - other.owner = nullptr; + //other.owner = nullptr; } /** @@ -413,10 +413,22 @@ public: finalize(); owner = other.owner; c = std::move(other.c); - other.owner = nullptr; + //other.owner = nullptr; return *this; } + /** + * Copy assignment while keeping the owner. + * + * @param other is the collection instance that should be copied. + */ + void assign(const own_type &other) + { + finalize(); + c = other.c; + initialize(); + } + /** * Equality operator. */ -- cgit v1.2.3