@@ -178,8 +178,11 @@ class HashMap {
178
178
explicit HashMap (uint32_t aLen) : mImpl(AllocPolicy(), aLen) {}
179
179
180
180
// HashMap is movable.
181
- HashMap (HashMap&& aRhs) = default ;
182
- HashMap& operator =(HashMap&& aRhs) = default ;
181
+ HashMap (HashMap&& aRhs) : mImpl (std::move(aRhs.mImpl )) {}
182
+ void operator =(HashMap&& aRhs) {
183
+ MOZ_ASSERT (this != &aRhs, " self-move assignment is prohibited" );
184
+ mImpl = std::move (aRhs.mImpl );
185
+ }
183
186
184
187
// -- Status and sizing ----------------------------------------------------
185
188
@@ -460,8 +463,11 @@ class HashSet {
460
463
explicit HashSet (uint32_t aLen) : mImpl(AllocPolicy(), aLen) {}
461
464
462
465
// HashSet is movable.
463
- HashSet (HashSet&& aRhs) = default ;
464
- HashSet& operator =(HashSet&& aRhs) = default ;
466
+ HashSet (HashSet&& aRhs) : mImpl (std::move(aRhs.mImpl )) {}
467
+ void operator =(HashSet&& aRhs) {
468
+ MOZ_ASSERT (this != &aRhs, " self-move assignment is prohibited" );
469
+ mImpl = std::move (aRhs.mImpl );
470
+ }
465
471
466
472
// -- Status and sizing ----------------------------------------------------
467
473
@@ -905,8 +911,13 @@ class HashMapEntry {
905
911
: key_(std::forward<KeyInput>(aKey)),
906
912
value_ (std::forward<ValueInput>(aValue)) {}
907
913
908
- HashMapEntry (HashMapEntry&& aRhs) = default;
909
- HashMapEntry& operator =(HashMapEntry&& aRhs) = default ;
914
+ HashMapEntry (HashMapEntry&& aRhs)
915
+ : key_(std::move(aRhs.key_)), value_(std::move(aRhs.value_)) {}
916
+
917
+ void operator =(HashMapEntry&& aRhs) {
918
+ key_ = std::move (aRhs.key_ );
919
+ value_ = std::move (aRhs.value_ );
920
+ }
910
921
911
922
using KeyType = Key;
912
923
using ValueType = Value;
@@ -1503,14 +1514,13 @@ class HashTable : private AllocPolicy {
1503
1514
1504
1515
// HashTable is movable
1505
1516
HashTable (HashTable&& aRhs) : AllocPolicy(std::move(aRhs)) { moveFrom (aRhs); }
1506
- HashTable& operator =(HashTable&& aRhs) {
1517
+ void operator =(HashTable&& aRhs) {
1507
1518
MOZ_ASSERT (this != &aRhs, " self-move assignment is prohibited" );
1508
1519
if (mTable ) {
1509
1520
destroyTable (*this , mTable , capacity ());
1510
1521
}
1511
1522
AllocPolicy::operator =(std::move (aRhs));
1512
1523
moveFrom (aRhs);
1513
- return *this ;
1514
1524
}
1515
1525
1516
1526
private:
0 commit comments