@@ -3473,14 +3473,19 @@ class parallel_hash_set
3473
3473
return it == end () ? node_type () : extract (const_iterator{it});
3474
3474
}
3475
3475
3476
- void swap (parallel_hash_set& that) noexcept (
3477
- IsNoThrowSwappable<EmbeddedSet>() &&
3478
- (!AllocTraits::propagate_on_container_swap::value ||
3479
- IsNoThrowSwappable<allocator_type>())) {
3476
+ template <class Mtx2_ >
3477
+ void swap (parallel_hash_set<N, RefSet, Mtx2_, Policy, Hash, Eq, Alloc>& that)
3478
+ noexcept (IsNoThrowSwappable<EmbeddedSet>() &&
3479
+ (!AllocTraits::propagate_on_container_swap::value ||
3480
+ IsNoThrowSwappable<allocator_type>()))
3481
+ {
3480
3482
using std::swap;
3483
+ using Lockable2 = phmap::LockableImpl<Mtx2_>;
3484
+
3481
3485
for (size_t i=0 ; i<num_tables; ++i)
3482
3486
{
3483
- typename Lockable::UniqueLocks l (sets_[i], that.sets_ [i]);
3487
+ typename Lockable::UniqueLock l (sets_[i]);
3488
+ typename Lockable2::UniqueLock l2 (that.sets_ [i]);
3484
3489
swap (sets_[i].set_ , that.sets_ [i].set_ );
3485
3490
}
3486
3491
}
@@ -3620,8 +3625,11 @@ class parallel_hash_set
3620
3625
return !(a == b);
3621
3626
}
3622
3627
3628
+ template <class Mtx2_ >
3623
3629
friend void swap (parallel_hash_set& a,
3624
- parallel_hash_set& b) noexcept (noexcept (a.swap(b))) {
3630
+ parallel_hash_set<N, RefSet, Mtx2_, Policy, Hash, Eq, Alloc>& b)
3631
+ noexcept (noexcept (a.swap(b)))
3632
+ {
3625
3633
a.swap (b);
3626
3634
}
3627
3635
@@ -3700,14 +3708,16 @@ class parallel_hash_set
3700
3708
3701
3709
// TODO(alkis): Optimize this assuming *this and that don't overlap.
3702
3710
// --------------------------------------------------------------------
3703
- parallel_hash_set& move_assign (parallel_hash_set&& that, std::true_type) {
3704
- parallel_hash_set tmp (std::move (that));
3711
+ template <class Mtx2_ >
3712
+ parallel_hash_set& move_assign (parallel_hash_set<N, RefSet, Mtx2_, Policy, Hash, Eq, Alloc>&& that, std::true_type) {
3713
+ parallel_hash_set<N, RefSet, Mtx2_, Policy, Hash, Eq, Alloc> tmp (std::move (that));
3705
3714
swap (tmp);
3706
3715
return *this ;
3707
3716
}
3708
3717
3709
- parallel_hash_set& move_assign (parallel_hash_set&& that, std::false_type) {
3710
- parallel_hash_set tmp (std::move (that), alloc_ref ());
3718
+ template <class Mtx2_ >
3719
+ parallel_hash_set& move_assign (parallel_hash_set<N, RefSet, Mtx2_, Policy, Hash, Eq, Alloc>&& that, std::false_type) {
3720
+ parallel_hash_set<N, RefSet, Mtx2_, Policy, Hash, Eq, Alloc> tmp (std::move (that), alloc_ref ());
3711
3721
swap (tmp);
3712
3722
return *this ;
3713
3723
}
0 commit comments