diff --git a/include/tsl/bhopscotch_map.h b/include/tsl/bhopscotch_map.h index 3e450c6..0d3cbd8 100644 --- a/include/tsl/bhopscotch_map.h +++ b/include/tsl/bhopscotch_map.h @@ -415,7 +415,9 @@ class bhopscotch_map { return m_ht.erase(key, precalculated_hash); } - void swap(bhopscotch_map& other) noexcept(noexcept(other.m_ht.swap(m_ht))) { other.m_ht.swap(m_ht); } + void swap(bhopscotch_map& other) noexcept(noexcept(other.m_ht.swap(m_ht))) { + other.m_ht.swap(m_ht); + } /* * Lookup @@ -786,7 +788,10 @@ class bhopscotch_map { return !operator==(lhs, rhs); } - friend void swap(bhopscotch_map& lhs, bhopscotch_map& rhs) noexcept(noexcept(lhs.swap(rhs))) { lhs.swap(rhs); } + friend void swap(bhopscotch_map& lhs, + bhopscotch_map& rhs) noexcept(noexcept(lhs.swap(rhs))) { + lhs.swap(rhs); + } private: ht m_ht; diff --git a/include/tsl/bhopscotch_set.h b/include/tsl/bhopscotch_set.h index e9d76ac..bfc9fdd 100644 --- a/include/tsl/bhopscotch_set.h +++ b/include/tsl/bhopscotch_set.h @@ -310,7 +310,9 @@ class bhopscotch_set { return m_ht.erase(key, precalculated_hash); } - void swap(bhopscotch_set& other) noexcept(noexcept(other.m_ht.swap(m_ht))) { other.m_ht.swap(m_ht); } + void swap(bhopscotch_set& other) noexcept(noexcept(other.m_ht.swap(m_ht))) { + other.m_ht.swap(m_ht); + } /* * Lookup @@ -598,7 +600,10 @@ class bhopscotch_set { return !operator==(lhs, rhs); } - friend void swap(bhopscotch_set& lhs, bhopscotch_set& rhs) noexcept(noexcept(lhs.swap(rhs))) { lhs.swap(rhs); } + friend void swap(bhopscotch_set& lhs, + bhopscotch_set& rhs) noexcept(noexcept(lhs.swap(rhs))) { + lhs.swap(rhs); + } private: ht m_ht; diff --git a/include/tsl/hopscotch_growth_policy.h b/include/tsl/hopscotch_growth_policy.h index 98ec5f4..1257e5b 100644 --- a/include/tsl/hopscotch_growth_policy.h +++ b/include/tsl/hopscotch_growth_policy.h @@ -403,13 +403,15 @@ class prime_growth_policy { * SFINAE helper to detect growth policies which can be noexcept-initialized * with a zero min bucket count. */ -template +template struct is_noexcept_on_zero_init : std::false_type {}; -template -struct is_noexcept_on_zero_init> : std::true_type {}; -template -struct is_noexcept_on_zero_init> : std::true_type {}; -template<> +template +struct is_noexcept_on_zero_init> + : std::true_type {}; +template +struct is_noexcept_on_zero_init> + : std::true_type {}; +template <> struct is_noexcept_on_zero_init : std::true_type {}; } // namespace hh diff --git a/include/tsl/hopscotch_hash.h b/include/tsl/hopscotch_hash.h index df861ae..19f6ac2 100644 --- a/include/tsl/hopscotch_hash.h +++ b/include/tsl/hopscotch_hash.h @@ -43,7 +43,6 @@ #include "hopscotch_growth_policy.h" - namespace tsl { namespace detail_hopscotch_hash { @@ -585,13 +584,15 @@ class hopscotch_hash : private Hash, private KeyEqual, private GrowthPolicy { template < class OC = OverflowContainer, typename std::enable_if::value>::type* = nullptr> - hopscotch_hash() noexcept(hopscotch_hash::DEFAULT_INIT_BUCKETS_SIZE == 0 && - std::is_nothrow_default_constructible::value && - std::is_nothrow_default_constructible::value && - std::is_nothrow_default_constructible::value && - (std::is_nothrow_constructible::value || - hh::is_noexcept_on_zero_init::value)) - : hopscotch_hash(DEFAULT_INIT_BUCKETS_SIZE, Hash(), KeyEqual(), Allocator(), DEFAULT_MAX_LOAD_FACTOR) {} + hopscotch_hash() noexcept( + hopscotch_hash::DEFAULT_INIT_BUCKETS_SIZE == 0 && + std::is_nothrow_default_constructible::value && + std::is_nothrow_default_constructible::value && + std::is_nothrow_default_constructible::value && + (std::is_nothrow_constructible::value || + hh::is_noexcept_on_zero_init::value)) + : hopscotch_hash(DEFAULT_INIT_BUCKETS_SIZE, Hash(), KeyEqual(), + Allocator(), DEFAULT_MAX_LOAD_FACTOR) {} template < class OC = OverflowContainer, @@ -633,13 +634,16 @@ class hopscotch_hash : private Hash, private KeyEqual, private GrowthPolicy { template < class OC = OverflowContainer, typename std::enable_if::value>::type* = nullptr> - hopscotch_hash() noexcept(hopscotch_hash::DEFAULT_INIT_BUCKETS_SIZE == 0 && - std::is_nothrow_default_constructible::value && - std::is_nothrow_default_constructible::value && - std::is_nothrow_default_constructible::value && - (std::is_nothrow_constructible::value || - hh::is_noexcept_on_zero_init::value)) - : hopscotch_hash(DEFAULT_INIT_BUCKETS_SIZE, Hash(), KeyEqual(), Allocator(), DEFAULT_MAX_LOAD_FACTOR, typename OC::key_compare()) {} + hopscotch_hash() noexcept( + hopscotch_hash::DEFAULT_INIT_BUCKETS_SIZE == 0 && + std::is_nothrow_default_constructible::value && + std::is_nothrow_default_constructible::value && + std::is_nothrow_default_constructible::value && + (std::is_nothrow_constructible::value || + hh::is_noexcept_on_zero_init::value)) + : hopscotch_hash(DEFAULT_INIT_BUCKETS_SIZE, Hash(), KeyEqual(), + Allocator(), DEFAULT_MAX_LOAD_FACTOR, + typename OC::key_compare()) {} template < class OC = OverflowContainer, @@ -741,7 +745,8 @@ class hopscotch_hash : private Hash, private KeyEqual, private GrowthPolicy { return *this; } - hopscotch_hash& operator=(hopscotch_hash&& other) noexcept(noexcept(other.swap(*this))) { + hopscotch_hash& operator=(hopscotch_hash&& other) noexcept( + noexcept(other.swap(*this))) { other.swap(*this); other.clear(); @@ -1046,11 +1051,11 @@ class hopscotch_hash : private Hash, private KeyEqual, private GrowthPolicy { return 0; } - void swap(hopscotch_hash& other) noexcept(std::is_nothrow_swappable::value && - std::is_nothrow_swappable::value && - std::is_nothrow_swappable::value && - std::is_nothrow_swappable::value && - std::is_nothrow_swappable::value) { + void swap(hopscotch_hash& other) noexcept( + std::is_nothrow_swappable::value&& std::is_nothrow_swappable< + KeyEqual>::value&& std::is_nothrow_swappable::value&& + std::is_nothrow_swappable::value&& + std::is_nothrow_swappable::value) { using std::swap; swap(static_cast(*this), static_cast(other)); diff --git a/include/tsl/hopscotch_map.h b/include/tsl/hopscotch_map.h index 539a350..62bc1de 100644 --- a/include/tsl/hopscotch_map.h +++ b/include/tsl/hopscotch_map.h @@ -425,7 +425,9 @@ class hopscotch_map { return m_ht.erase(key, precalculated_hash); } - void swap(hopscotch_map& other) noexcept(noexcept(other.m_ht.swap(m_ht))) { other.m_ht.swap(m_ht); } + void swap(hopscotch_map& other) noexcept(noexcept(other.m_ht.swap(m_ht))) { + other.m_ht.swap(m_ht); + } /* * Lookup @@ -784,7 +786,10 @@ class hopscotch_map { return !operator==(lhs, rhs); } - friend void swap(hopscotch_map& lhs, hopscotch_map& rhs) noexcept(noexcept(lhs.swap(rhs))) { lhs.swap(rhs); } + friend void swap(hopscotch_map& lhs, + hopscotch_map& rhs) noexcept(noexcept(lhs.swap(rhs))) { + lhs.swap(rhs); + } private: ht m_ht; diff --git a/include/tsl/hopscotch_set.h b/include/tsl/hopscotch_set.h index 5cd0a37..f80573e 100644 --- a/include/tsl/hopscotch_set.h +++ b/include/tsl/hopscotch_set.h @@ -324,7 +324,9 @@ class hopscotch_set { return m_ht.erase(key, precalculated_hash); } - void swap(hopscotch_set& other) noexcept(noexcept(other.m_ht.swap(m_ht))) { other.m_ht.swap(m_ht); } + void swap(hopscotch_set& other) noexcept(noexcept(other.m_ht.swap(m_ht))) { + other.m_ht.swap(m_ht); + } /* * Lookup @@ -601,7 +603,10 @@ class hopscotch_set { return !operator==(lhs, rhs); } - friend void swap(hopscotch_set& lhs, hopscotch_set& rhs) noexcept(noexcept(lhs.swap(rhs))) { lhs.swap(rhs); } + friend void swap(hopscotch_set& lhs, + hopscotch_set& rhs) noexcept(noexcept(lhs.swap(rhs))) { + lhs.swap(rhs); + } private: ht m_ht;