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