Browse Source

Str: allow move assignment to self (#2698)

* Containers: allow move assignment to self

It's used for instance when shuffling a std::vector of String

* Remove unnecessary checks

Co-authored-by: moneromooo <moneromooo>
Co-authored-by: Eugene Kozlov <[email protected]>
moneromooo 5 years ago
parent
commit
d5644c93cb

+ 0 - 1
Source/Urho3D/Container/HashMap.h

@@ -273,7 +273,6 @@ public:
     /// Move-assign a hash map.
     HashMap& operator =(HashMap<T, U> && rhs) noexcept
     {
-        assert(&rhs != this);
         Swap(rhs);
         return *this;
     }

+ 0 - 1
Source/Urho3D/Container/HashSet.h

@@ -230,7 +230,6 @@ public:
     /// Move-assign a hash set.
     HashSet& operator =(HashSet<T> && rhs) noexcept
     {
-        assert(&rhs != this);
         Swap(rhs);
         return *this;
     }

+ 0 - 1
Source/Urho3D/Container/List.h

@@ -219,7 +219,6 @@ public:
     /// Move-assign from another list.
     List& operator =(List<T> && rhs) noexcept
     {
-        assert(&rhs != this);
         Swap(rhs);
         return *this;
     }

+ 0 - 1
Source/Urho3D/Container/Str.h

@@ -182,7 +182,6 @@ public:
     /// Move-assign a string.
     String& operator =(String && rhs) noexcept
     {
-        assert(&rhs != this);
         Swap(rhs);
         return *this;
     }

+ 0 - 1
Source/Urho3D/Container/Vector.h

@@ -122,7 +122,6 @@ public:
     /// Move-assign from another vector.
     Vector<T>& operator =(Vector<T> && rhs)
     {
-        assert(&rhs != this);
         Swap(rhs);
         return *this;
     }