diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-17 15:27:09 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-17 15:27:09 +0100 |
commit | 97b364112f0c9f3378011d6567433923f9fd8328 (patch) | |
tree | 719c1282eefa45638d3b978435882558952204b6 /src/core/managed/ManagedContainer.hpp | |
parent | 8992dc8c4359964168da3e9221a31bfe9e4ffe8f (diff) |
Managed container does not reset owner on move -- this allows the container to be reusable after a move. Adapted unit test accordingly.
Diffstat (limited to 'src/core/managed/ManagedContainer.hpp')
-rw-r--r-- | src/core/managed/ManagedContainer.hpp | 22 |
1 files changed, 17 insertions, 5 deletions
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<value_type> 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,11 +413,23 @@ 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. */ bool operator==(const own_type &other) |