1#if !defined(phmap_h_guard_)
92 #pragma warning(disable : 4127)
93 #pragma warning(disable : 4324)
94 #pragma warning(disable : 4514)
95 #pragma warning(disable : 4623)
96 #pragma warning(disable : 4625)
97 #pragma warning(disable : 4626)
98 #pragma warning(disable : 4710)
99 #pragma warning(disable : 4711)
100 #pragma warning(disable : 4820)
101 #pragma warning(disable : 4868)
102 #pragma warning(disable : 5027)
103 #pragma warning(disable : 5045)
113#include <type_traits>
123#if PHMAP_HAVE_STD_STRING_VIEW
124 #include <string_view>
132template <
typename AllocType>
138template <
typename AllocType>
143template <
size_t W
idth>
148 assert(((mask + 1) & mask) == 0 &&
"not a mask");
170template <
class ContainerKey,
class Hash,
class Eq>
173 template <
class PassedKey,
class... Args>
175 decltype(std::declval<const Hash&>()(std::declval<const PassedKey&>())),
176 decltype(std::declval<const Eq&>()(std::declval<const ContainerKey&>(),
177 std::declval<const PassedKey&>()))>*
182template <
class E,
class Policy,
class Hash,
class Eq,
class... Ts>
185template <
class Policy,
class Hash,
class Eq,
class... Ts>
188 Policy::apply(RequireUsableKey<typename Policy::key_type, Hash, Eq>(),
189 std::declval<Ts>()...))>,
190 Policy,
Hash, Eq, Ts...> : std::true_type {};
197 return noexcept(swap(std::declval<T&>(), std::declval<T&>()));
229template <
class T,
int SignificantBits,
int Shift = 0>
232 static_assert(std::is_unsigned<T>::value,
"");
233 static_assert(Shift == 0 || Shift == 3,
"");
267 constexpr uint32_t total_significant_bits = SignificantBits << Shift;
268 constexpr uint32_t extra_bits =
sizeof(T) * 8 - total_significant_bits;
300 "Special markers need to have the MSB to make checking for them efficient");
302 "kEmpty and kDeleted must be smaller than kSentinel to make the "
303 "SIMD test of IsEmptyOrDeleted() efficient");
305 "kSentinel must be -1 to elide loading it from memory into SIMD "
306 "registers (pcmpeqd xmm, xmm)");
307static_assert(
kEmpty == -128,
308 "kEmpty must be -128 to make the SIMD check for its "
309 "existence efficient (psignb xmm, xmm)");
310static_assert(~kEmpty & ~kDeleted &
kSentinel & 0x7F,
311 "kEmpty and kDeleted must share an unset bit that is not shared "
312 "by kSentinel to make the scalar test for MatchEmptyOrDeleted() "
315 "kDeleted must be -2 to make the implementation of "
316 "ConvertSpecialToEmptyAndFullToDeleted efficient");
323 alignas(16)
static constexpr ctrl_t empty_group[] = {
326 return const_cast<ctrl_t*
>(empty_group);
334 return reinterpret_cast<uintptr_t
>(ctrl) >> 12;
337#ifdef PHMAP_NON_DETERMINISTIC
339inline size_t H1(
size_t hashval,
const ctrl_t* ctrl) {
342 return (hashval >> 7) ^
HashSeed(ctrl);
348 return (hashval >> 7);
364 #pragma warning(push)
365 #pragma warning(disable : 4365)
375inline __m128i _mm_cmpgt_epi8_fixed(__m128i a, __m128i b) {
376#if defined(__GNUC__) && !defined(__clang__)
377 #pragma GCC diagnostic push
378 #pragma GCC diagnostic ignored "-Woverflow"
380 if (std::is_unsigned<char>::value) {
381 const __m128i mask = _mm_set1_epi8(
static_cast<char>(0x80));
382 const __m128i diff = _mm_subs_epi8(b, a);
383 return _mm_cmpeq_epi8(_mm_and_si128(diff, mask), mask);
386 #pragma GCC diagnostic pop
388 return _mm_cmpgt_epi8(a, b);
395 enum { kWidth = 16 };
397 explicit GroupSse2Impl(
const ctrl_t* pos) {
398 ctrl = _mm_loadu_si128(
reinterpret_cast<const __m128i*
>(pos));
403 BitMask<uint32_t, kWidth> Match(h2_t hash)
const {
404 auto match = _mm_set1_epi8((
char)hash);
405 return BitMask<uint32_t, kWidth>(
406 static_cast<uint32_t
>(_mm_movemask_epi8(_mm_cmpeq_epi8(match, ctrl))));
411 BitMask<uint32_t, kWidth> MatchEmpty()
const {
414 return BitMask<uint32_t, kWidth>(
415 static_cast<uint32_t
>(_mm_movemask_epi8(_mm_sign_epi8(ctrl, ctrl))));
417 return Match(
static_cast<h2_t>(kEmpty));
421#ifdef __INTEL_COMPILER
423#pragma warning disable 68
427 BitMask<uint32_t, kWidth> MatchEmptyOrDeleted()
const {
428 auto special = _mm_set1_epi8(
static_cast<uint8_t
>(kSentinel));
429 return BitMask<uint32_t, kWidth>(
430 static_cast<uint32_t
>(_mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl))));
435 uint32_t CountLeadingEmptyOrDeleted()
const {
436 auto special = _mm_set1_epi8(
static_cast<uint8_t
>(kSentinel));
438 static_cast<uint32_t
>(_mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)) + 1));
440#ifdef __INTEL_COMPILER
445 void ConvertSpecialToEmptyAndFullToDeleted(ctrl_t* dst)
const {
446 auto msbs = _mm_set1_epi8(
static_cast<char>(-128));
447 auto x126 = _mm_set1_epi8(126);
449 auto res = _mm_or_si128(_mm_shuffle_epi8(x126, ctrl), msbs);
451 auto zero = _mm_setzero_si128();
452 auto special_mask = _mm_cmpgt_epi8_fixed(zero, ctrl);
453 auto res = _mm_or_si128(msbs, _mm_andnot_si128(special_mask, x126));
455 _mm_storeu_si128(
reinterpret_cast<__m128i*
>(dst), res);
474 :
ctrl(little_endian::Load64(pos)) {}
490 constexpr uint64_t msbs = 0x8080808080808080ULL;
491 constexpr uint64_t lsbs = 0x0101010101010101ULL;
492 auto x =
ctrl ^ (lsbs * hash);
497 constexpr uint64_t msbs = 0x8080808080808080ULL;
502 constexpr uint64_t msbs = 0x8080808080808080ULL;
507 constexpr uint64_t gaps = 0x00FEFEFEFEFEFEFEULL;
512 constexpr uint64_t msbs = 0x8080808080808080ULL;
513 constexpr uint64_t lsbs = 0x0101010101010101ULL;
514 auto x =
ctrl & msbs;
515 auto res = (~x + (x >> 7)) & ~lsbs;
523 using Group = GroupSse2Impl;
533template <
class Policy,
class Hash,
class Eq,
class Alloc>
549 ctrl_t* ctrl,
size_t capacity)
584 return capacity - capacity / 8;
601 return growth +
static_cast<size_t>((
static_cast<int64_t
>(growth) - 1) / 7);
604namespace hashtable_debug_internal {
608template <
typename T,
typename =
typename T::mapped_type>
609auto GetKey(
const typename T::value_type& pair,
int) ->
decltype(get<0>(pair)) {
615const typename T::key_type&
GetKey(
const typename T::key_type& key,
char) {
623template <
class Container,
typename Enabler =
void>
636 const typename Container::key_type& key) {
637 if (!c.bucket_count())
return {};
638 size_t num_probes = 0;
639 size_t bucket = c.bucket(key);
640 for (
auto it = c.begin(bucket), e = c.end(bucket);; ++it, ++num_probes) {
641 if (it == e)
return num_probes;
642 if (c.key_eq()(key, GetKey<Container>(*it, 0)))
return num_probes;
697namespace memory_internal {
702template <
class Alloc,
class T,
class Tuple,
size_t... I>
706 *alloc, ptr, std::get<I>(std::forward<Tuple>(t))...);
709template <
class T,
class F>
711 template <
class... Args>
713 Args&&... args)
const {
714 return std::forward<F>(
f)(T(std::forward<Args>(args)...));
719template <
class T,
class Tuple,
size_t... Is,
class F>
723 std::get<Is>(std::forward<Tuple>(t))...);
726template <
class T,
size_t... Is>
728 ->
decltype(std::forward_as_tuple(std::get<Is>(std::forward<T>(t))...)) {
729 return std::forward_as_tuple(std::get<Is>(std::forward<T>(t))...);
739 std::tuple_size<
typename std::decay<T>::type>::value>())) {
743 std::tuple_size<
typename std::decay<T>::type>::value>());
746template <
class F,
class K,
class V>
747decltype(std::declval<F>()(std::declval<const K&>(), std::piecewise_construct,
748 std::declval<std::tuple<K>>(), std::declval<V>()))
750 const auto& key = std::get<0>(p.first);
751 return std::forward<F>(f)(key, std::piecewise_construct, std::move(p.first),
752 std::move(p.second));
837template <
class Policy,
class Hash,
class Eq,
class Alloc>
862 allocator_type>::template rebind_traits<value_type>::const_pointer;
869 using key_arg =
typename KeyArgImpl::template type<K, key_type>;
889 static_assert(std::is_lvalue_reference<reference>::value,
890 "Policy::element() must return a reference");
892 template <
typename T>
894 : std::is_same<typename std::remove_cv<
895 typename std::remove_reference<reference>::type>::type,
896 typename std::remove_cv<
897 typename std::remove_reference<T>::type>::type> {};
914 typename std::enable_if<!std::is_same<T, init_type>::value,
int>::type;
916 template <
class... Ts>
920 static_assert(std::is_same<pointer, value_type*>::value,
921 "Allocators with custom pointer types are not supported");
922 static_assert(std::is_same<const_pointer, const value_type*>::value,
923 "Allocators with custom pointer types are not supported");
960#if PHMAP_BIDIRECTIONAL
996 uint32_t shift =
Group{
ctrl_}.CountLeadingEmptyOrDeleted();
1052 std::is_nothrow_default_constructible<
hasher>::value&&
1053 std::is_nothrow_default_constructible<
key_equal>::value&&
1078 template <
class InputIter>
1086 template <
class InputIter>
1091 template <
class InputIter>
1096 template <
class InputIter>
1121 template <
class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
1132 template <
class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
1141 template <
class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
1150 template <
class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
1167 for (
const auto& v : that) {
1179 std::is_nothrow_copy_constructible<hasher>::value&&
1180 std::is_nothrow_copy_constructible<key_equal>::value&&
1181 std::is_nothrow_copy_constructible<allocator_type>::value)
1192 that.growth_left() = 0;
1201 if (a == that.alloc_ref()) {
1202 std::swap(
ctrl_, that.ctrl_);
1203 std::swap(
slots_, that.slots_);
1204 std::swap(
size_, that.size_);
1207 std::swap(
infoz_, that.infoz_);
1212 for (
auto& elem : that)
insert(std::move(elem));
1218 AllocTraits::propagate_on_container_copy_assignment::value
1227 std::is_nothrow_move_assignable<hasher>::value&&
1228 std::is_nothrow_move_assignable<key_equal>::value) {
1240 it.skip_empty_or_deleted();
1245#if PHMAP_BIDIRECTIONAL
1262 size_t max_size()
const {
return (std::numeric_limits<size_t>::max)(); }
1277 for (
size_t i = 0; i !=
capacity_; ++i) {
1295 template <
class T, RequiresInsertable<T> = 0,
1296 typename std::enable_if<IsDecomposable<T>::value,
int>::type = 0,
1298 std::pair<iterator, bool>
insert(T&& value) {
1299 return emplace(std::forward<T>(value));
1316 template <
class T, RequiresInsertable<T> = 0,
1317 typename std::enable_if<IsDecomposable<const T&>::value,
int>::type = 0>
1318 std::pair<iterator, bool>
insert(
const T& value) {
1328 return emplace(std::move(value));
1331 template <
class T, RequiresInsertable<T> = 0,
1332 typename std::enable_if<IsDecomposable<T>::value,
int>::type = 0,
1335 return insert(std::forward<T>(value)).first;
1341 template <
class T, RequiresInsertable<T> = 0,
1342 typename std::enable_if<IsDecomposable<const T&>::value,
int>::type = 0>
1344 return insert(value).first;
1348 return insert(std::move(value)).first;
1351 template <
typename It>
1352 using IsRandomAccess = std::is_same<typename std::iterator_traits<It>::iterator_category,
1353 std::random_access_iterator_tag>;
1356 template<
typename T>
1361 using no = std::false_type;
1363 template<
typename U>
static auto test(
int) ->
decltype(std::declval<U>() - std::declval<U>() == 1,
yes());
1370 template <class InputIt, typename phmap::enable_if_t<has_difference_operator<InputIt>::value,
int> = 0>
1373 for (; first != last; ++first)
1377 template <class InputIt, typename phmap::enable_if_t<!has_difference_operator<InputIt>::value,
int> = 0>
1379 for (; first != last; ++first)
1383 template <
class T, RequiresNotInit<T> = 0, RequiresInsertable<const T&> = 0>
1384 void insert(std::initializer_list<T> ilist) {
1385 insert(ilist.begin(), ilist.end());
1388 void insert(std::initializer_list<init_type> ilist) {
1389 insert(ilist.begin(), ilist.end());
1402 return {res.first,
false, std::move(node)};
1416 return {res.first,
false, std::move(node)};
1421 auto res =
insert(std::move(node));
1422 node = std::move(res.node);
1423 return res.position;
1435 template <
class... Args,
typename std::enable_if<
1437 std::pair<iterator, bool>
emplace(Args&&... args) {
1439 std::forward<Args>(args)...);
1442 template <
class... Args,
typename std::enable_if<
IsDecomposable<Args...>::value,
int>::type = 0>
1450 template <
class... Args,
typename std::enable_if<
1452 std::pair<iterator, bool>
emplace(Args&&... args) {
1462 template <
class... Args,
typename std::enable_if<!
IsDecomposable<Args...>::value,
int>::type = 0>
1472 template <
class... Args>
1474 return emplace(std::forward<Args>(args)...).first;
1477 template <
class... Args>
1509 template <
class... Args>
1523 template <
class K = key_type,
class F>
1532 template <
class K = key_type,
class F>
1541 template <
class K = key_type,
class F>
1548 template <
class K = key_type,
class F>
1567 template <
class K = key_type>
1569 auto it =
find(key);
1570 if (it ==
end())
return 0;
1591 assert(it !=
end());
1607 while (first != last) {
1615 template <
typename H,
typename E>
1617 assert(
this != &src);
1618 for (
auto it = src.
begin(), e = src.
end(); it != e; ++it) {
1627 template <
typename H,
typename E>
1641 typename std::enable_if<!std::is_same<K, iterator>::value,
int>::type = 0>
1643 auto it =
find(key);
1648 IsNoThrowSwappable<hasher>() && IsNoThrowSwappable<key_equal>() &&
1649 (!AllocTraits::propagate_on_container_swap::value ||
1650 IsNoThrowSwappable<allocator_type>())) {
1660 if (AllocTraits::propagate_on_container_swap::value) {
1668#if !defined(PHMAP_NON_DETERMINISTIC)
1669 template<
typename OutputArchive>
1672 template<
typename InputArchive>
1678 if (n == 0 &&
size_ == 0) {
1703 template <
class K = key_type>
1705 return find(key) ==
end() ? size_t(0) : size_t(1);
1715#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
1716 auto seq =
probe(hashval);
1717 _mm_prefetch((
const char *)(
ctrl_ + seq.offset()), _MM_HINT_NTA);
1718 _mm_prefetch((
const char *)(
slots_ + seq.offset()), _MM_HINT_NTA);
1719#elif defined(__GNUC__)
1720 auto seq =
probe(hashval);
1721 __builtin_prefetch(
static_cast<const void*
>(
ctrl_ + seq.offset()));
1722 __builtin_prefetch(
static_cast<const void*
>(
slots_ + seq.offset()));
1726 template <
class K = key_type>
1738 template <
class K = key_type>
1747 template <
class K = key_type>
1756 template <
class K = key_type>
1761 template <
class K = key_type>
1765 template <
class K = key_type>
1770 template <
class K = key_type>
1775 template <
class K = key_type>
1777 return find(key, hashval) !=
end();
1780 template <
class K = key_type>
1782 auto it =
find(key);
1783 if (it !=
end())
return {it, std::next(it)};
1786 template <
class K = key_type>
1789 auto it =
find(key);
1790 if (it !=
end())
return {it, std::next(it)};
1808 if (a.
size() != b.
size())
return false;
1812 std::swap(outer, inner);
1833 template <
class Container,
typename Enabler>
1836 template <
class K = key_type>
1838 auto seq =
probe(hashval);
1841 for (uint32_t i : g.Match((
h2_t)
H2(hashval))) {
1842 offset = seq.offset((
size_t)i);
1856 template <
class K,
class... Args>
1865 template <
class K,
class... Args>
1875 template <
class K2,
class... Args>
1877 return eq(lhs,
rhs);
1883 template <
class K,
class... Args>
1889 emplace_at(res.first, std::forward<Args>(args)...);
1896 template <
class K,
class... Args>
1897 std::pair<iterator, bool>
operator()(
const K& key, Args&&... args)
const {
1904 template <
class K,
class... Args>
1905 std::pair<iterator, bool>
operator()(
const K& key, Args&&... args)
const {
1912 template <
bool do_destroy>
1915 template <
class K,
class... Args>
1916 std::pair<iterator, bool>
operator()(
const K& key, Args&&...) && {
1920 }
else if (do_destroy) {
1930 template <
bool do_destroy>
1933 template <
class K,
class... Args>
1934 std::pair<iterator, bool>
operator()(
const K& key, Args&&...) && {
1938 }
else if (do_destroy) {
1964 bool was_never_full =
1965 empty_before && empty_after &&
1966 static_cast<size_t>(empty_after.TrailingZeros() +
1975 assert(new_capacity);
1976 if (std::is_same<
SlotAlloc, std::allocator<slot_type>>::value &&
1982 char* mem =
static_cast<char*
>(
1983 Allocate<Layout::Alignment()>(&
alloc_ref(), layout.AllocSize()));
1984 ctrl_ =
reinterpret_cast<ctrl_t*
>(layout.template Pointer<0>(mem));
1985 slots_ = layout.template Pointer<1>(mem);
1993 for (
size_t i = 0; i !=
capacity_; ++i) {
2001 Deallocate<Layout::Alignment()>(&
alloc_ref(),
ctrl_, layout.AllocSize());
2011 auto* old_ctrl =
ctrl_;
2012 auto* old_slots =
slots_;
2017 for (
size_t i = 0; i != old_capacity; ++i) {
2018 if (
IsFull(old_ctrl[i])) {
2022 size_t new_i = target.offset;
2031 Deallocate<Layout::Alignment()>(&
alloc_ref(), old_ctrl,
2032 layout.AllocSize());
2059 for (
size_t i = 0; i !=
capacity_; ++i) {
2064 size_t new_i = target.offset;
2069 const auto probe_index = [&](
size_t pos) {
2112 auto seq =
probe(hashval);
2115 for (uint32_t i : g.Match((
h2_t)
H2(hashval))) {
2122 assert(seq.getindex() <
capacity_ &&
"full table!");
2147 auto seq =
probe(hashval);
2150 auto mask = g.MatchEmptyOrDeleted();
2152 return {seq.offset((
size_t)mask.LowestBitSet()), seq.getindex()};
2154 assert(seq.getindex() <
capacity_ &&
"full table!");
2174 auto seq =
probe(hashval);
2177 for (uint32_t i : g.Match((
h2_t)
H2(hashval))) {
2181 return {seq.offset((
size_t)i),
false};
2205 return target.offset;
2216 template <
class... Args>
2219 std::forward<Args>(args)...);
2223 "constructed value does not match the lookup key");
2266 template <
class,
class,
class,
class>
class RefSet,
2267 class M,
class P,
class H,
class E,
class A>
2271 template <
class,
class,
class,
class>
class RefSet,
2272 class M,
class P,
class H,
class E,
class A>
2316template <
class Policy,
class Hash,
class Eq,
class Alloc>
2324 std::addressof(std::declval<typename raw_hash_map::reference>())));
2329 std::addressof(std::declval<typename raw_hash_map::const_reference>())));
2340 using key_arg =
typename KeyArgImpl::template type<K, key_type>;
2342 static_assert(!std::is_reference<key_type>::value,
"");
2346 static_assert(!std::is_reference<mapped_type>::value,
"");
2348 using iterator =
typename raw_hash_map::raw_hash_set::iterator;
2367 template <
class K = key_type,
class V = mapped_type, K* =
nullptr>
2372 template <
class K = key_type,
class V = mapped_type, V* =
nullptr>
2377 template <
class K = key_type,
class V = mapped_type>
2388 template <
class K = key_type,
class V = mapped_type, K* =
nullptr>
2393 template <
class K = key_type,
class V = mapped_type, V* =
nullptr>
2398 template <
class K = key_type,
class V = mapped_type>
2403 template <
class K =
key_type,
class... Args,
2404 typename std::enable_if<
2405 !std::is_convertible<K, const_iterator>::value,
int>::type = 0,
2411 template <
class K =
key_type,
class... Args,
2412 typename std::enable_if<
2413 !std::is_convertible<K, const_iterator>::value,
int>::type = 0>
2418 template <
class K =
key_type,
class... Args, K* =
nullptr>
2420 return try_emplace(std::forward<K>(k), std::forward<Args>(args)...).first;
2423 template <
class K =
key_type,
class... Args>
2425 return try_emplace(k, std::forward<Args>(args)...).first;
2428 template <
class K = key_type,
class P = Policy>
2430 auto it = this->
find(key);
2431 if (it == this->
end())
2433 return Policy::value(&*it);
2436 template <
class K = key_type,
class P = Policy>
2438 auto it = this->
find(key);
2439 if (it == this->
end())
2441 return Policy::value(&*it);
2444 template <
class K = key_type,
class P = Policy, K* =
nullptr>
2446 return Policy::value(&*
try_emplace(std::forward<K>(key)).first);
2449 template <
class K = key_type,
class P = Policy>
2455 template <
class K,
class V>
2459 this->
emplace_at(res.first, std::forward<K>(k), std::forward<V>(v));
2461 Policy::value(&*this->
iterator_at(res.first)) = std::forward<V>(v);
2462 return {this->
iterator_at(res.first), res.second};
2465 template <
class K =
key_type,
class... Args>
2469 this->
emplace_at(res.first, std::piecewise_construct,
2470 std::forward_as_tuple(std::forward<K>(k)),
2471 std::forward_as_tuple(std::forward<Args>(args)...));
2472 return {this->
iterator_at(res.first), res.second};
2481#if PHMAP_HAVE_THREAD_LOCAL
2482 static thread_local size_t counter = 0;
2483 size_t value = ++counter;
2485 static std::atomic<size_t> counter(0);
2486 size_t value = counter.fetch_add(1, std::memory_order_relaxed);
2488 return value ^
static_cast<size_t>(
reinterpret_cast<uintptr_t
>(&counter));
2494 template <
class,
class,
class,
class>
class RefSet,
2496 class Policy,
class Hash,
class Eq,
class Alloc>
2503 static_assert(N <= 12,
"N = 12 means 4096 hash tables!");
2527 allocator_type>::template rebind_traits<value_type>::const_pointer;
2535 using key_arg =
typename KeyArgImpl::template type<K, key_type>;
2573 static_assert(std::is_lvalue_reference<reference>::value,
2574 "Policy::element() must return a reference");
2576 template <
typename T>
2578 typename std::remove_cv<typename std::remove_reference<reference>::type>::type,
2579 typename std::remove_cv<typename std::remove_reference<T>::type>::type> {};
2597 typename std::enable_if<!std::is_same<T, init_type>::value,
int>::type;
2599 template <
class... Ts>
2603 static_assert(std::is_same<pointer, value_type*>::value,
2604 "Allocators with custom pointer types are not supported");
2605 static_assert(std::is_same<const_pointer, const value_type*>::value,
2606 "Allocators with custom pointer types are not supported");
2714 const_cast<
Inner**>(inner_end),
2726 std::is_nothrow_default_constructible<
hasher>::value&&
2727 std::is_nothrow_default_constructible<
key_equal>::value&&
2730#if (__cplusplus >= 201703L || _MSVC_LANG >= 201402) && (defined(_MSC_VER) || defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 6))
2739 template <std::size_t... i>
2748 for (
auto& inner :
sets_)
2749 inner.set_ =
EmbeddedSet(bucket_cnt / N, hash_param, eq, alloc);
2754 const hasher& hash_param,
2764 template <
class InputIter>
2772 template <
class InputIter>
2777 template <
class InputIter>
2782 template <
class InputIter>
2808 template <
class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
2819 template <
class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
2828 template <
class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
2837 template <
class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
2856 std::is_nothrow_copy_constructible<hasher>::value&&
2857 std::is_nothrow_copy_constructible<key_equal>::value&&
2858 std::is_nothrow_copy_constructible<allocator_type>::value)
2865 sets_[i].set_ = { std::move(that.sets_[i]).set_, a };
2876 std::is_nothrow_move_assignable<hasher>::value &&
2877 std::is_nothrow_move_assignable<key_equal>::value) {
2879 sets_[i].set_ = std::move(that.sets_[i].set_);
2901 for (
const auto& inner :
sets_)
2902 sz += inner.set_.size();
2908 for (
const auto& inner :
sets_)
2909 c += inner.set_.capacity();
2913 size_t max_size()
const {
return (std::numeric_limits<size_t>::max)(); }
2916 for (
auto& inner :
sets_)
2937 template <
class T, RequiresInsertable<T> = 0,
2938 typename std::enable_if<IsDecomposable<T>::value,
int>::type = 0,
2940 std::pair<iterator, bool>
insert(T&& value) {
2941 return emplace(std::forward<T>(value));
2960 class T, RequiresInsertable<T> = 0,
2961 typename std::enable_if<IsDecomposable<const T&>::value,
int>::type = 0>
2962 std::pair<iterator, bool>
insert(
const T& value) {
2973 return emplace(std::move(value));
2976 template <
class T, RequiresInsertable<T> = 0,
2977 typename std::enable_if<IsDecomposable<T>::value,
int>::type = 0,
2980 return insert(std::forward<T>(value)).first;
2988 class T, RequiresInsertable<T> = 0,
2989 typename std::enable_if<IsDecomposable<const T&>::value,
int>::type = 0>
2991 return insert(value).first;
2995 return insert(std::move(value)).first;
2998 template <
class InputIt>
3000 for (; first != last; ++first)
insert(*first);
3003 template <
class T, RequiresNotInit<T> = 0, RequiresInsertable<const T&> = 0>
3004 void insert(std::initializer_list<T> ilist) {
3005 insert(ilist.begin(), ilist.end());
3008 void insert(std::initializer_list<init_type> ilist) {
3009 insert(ilist.begin(), ilist.end());
3015 auto& key = node.key();
3016 size_t hashval = this->
hash(key);
3018 auto& set = inner.
set_;
3021 auto res = set.insert(std::move(node), hashval);
3024 res.inserted ?
node_type() : std::move(res.node) };
3028 return insert(std::move(node)).first;
3033 template <
class Key,
class... Args>
3035 return std::forward<Key>(k);
3044 template <
class K,
class... Args>
3048 auto& set = inner.
set_;
3050 return make_rv(&inner, set.emplace_decomposable(key, hashval, std::forward<Args>(args)...));
3055 template <
class K,
class... Args>
3056 std::pair<iterator, bool>
operator()(
const K& key, Args&&... args)
const {
3073 template <
class... Args,
typename std::enable_if<
3077 std::forward<Args>(args)...);
3084 template <
class... Args,
typename std::enable_if<
3093 auto& set = inner.
set_;
3095 typename EmbeddedSet::template InsertSlotWithHash<true> f {
3096 inner, std::move(*slot), hashval};
3100 template <
class... Args>
3105 template <
class K = key_type,
class F>
3108 auto& set = inner.
set_;
3110 return make_iterator(&inner, set.lazy_emplace_with_hash(key, hashval, std::forward<F>(f)));
3117 template <
class K,
class... Args>
3120 size_t hashval = this->
hash(key);
3122 auto& set = inner.
set_;
3124 return make_rv(&inner, set.emplace_decomposable(key, hashval, std::forward<Args>(args)...));
3129 template <
class K,
class... Args>
3130 std::pair<iterator, bool>
operator()(
const K& key, Args&&... args)
const {
3146 template <
class... Args,
typename std::enable_if<
3148 std::pair<iterator, bool>
emplace(Args&&... args) {
3150 std::forward<Args>(args)...);
3157 template <
class... Args,
typename std::enable_if<
3159 std::pair<iterator, bool>
emplace(Args&&... args) {
3167 auto& set = inner.
set_;
3169 typename EmbeddedSet::template InsertSlotWithHash<true> f {
3170 inner, std::move(*slot), hashval};
3174 template <
class... Args>
3176 return emplace(std::forward<Args>(args)...).first;
3181 if (it == inner->
set_.end())
3187 const std::pair<EmbeddedIterator, bool>& res)
3194 template <
class K = key_type,
class F>
3196 auto hashval = this->
hash(key);
3198 auto& set = inner.
set_;
3200 return make_iterator(&inner, set.lazy_emplace_with_hash(key, hashval, std::forward<F>(f)));
3205 template <
class K = key_type,
class F>
3208 auto& set = inner.
set_;
3210 set.emplace_single_with_hash(key, hashval, std::forward<F>(f));
3213 template <
class K = key_type,
class F>
3215 auto hashval = this->
hash(key);
3216 emplace_single_with_hash<K, F>(key, hashval, std::forward<F>(f));
3222 template <
class K = key_type,
class F>
3225 modify_if_impl<K, F, typename Lockable::SharedLock>(key, std::forward<F>(f));
3232 template <
class K = key_type,
class F>
3241 template <
class K = key_type,
class F>
3243 return modify_if_impl<K, F, typename Lockable::UniqueLock>(key, std::forward<F>(f));
3247 template <
class K = key_type,
class F,
class L>
3249#if __cplusplus >= 201703L
3250 static_assert(std::is_invocable<F, value_type&>::value);
3253 auto ptr = this->
template find_ptr<K, L>(key, this->
hash(key), m);
3256 std::forward<F>(f)(*ptr);
3265 template <
class K = key_type,
class F>
3267 return erase_if_impl<K, F, typename Lockable::UniqueLock>(key, std::forward<F>(f));
3270 template <
class K = key_type,
class F,
class L>
3272#if __cplusplus >= 201703L
3273 static_assert(std::is_invocable<F, value_type&>::value);
3276 auto it = this->
template find<K, L>(key, this->
hash(key), m);
3277 if (it == this->
end())
return false;
3278 if (std::forward<F>(f)(
const_cast<value_type &
>(*it)))
3292 template <
class K = key_type,
class FExists,
class FEmplace>
3296 Inner* inner = std::get<0>(res);
3297 if (std::get<2>(res))
3298 inner->
set_.lazy_emplace_at(std::get<1>(res), std::forward<FEmplace>(fEmplace));
3300 auto it = this->
iterator_at(inner, inner->
set_.iterator_at(std::get<1>(res)));
3301 std::forward<FExists>(fExists)(
const_cast<value_type &
>(*it));
3303 return std::get<2>(res);
3315 for (
auto const& inner :
sets_) {
3317 std::for_each(inner.set_.begin(), inner.set_.end(), fCallback);
3324 for (
auto& inner :
sets_) {
3326 std::for_each(inner.set_.begin(), inner.set_.end(), fCallback);
3330#if __cplusplus >= 201703L
3331 template <
class ExecutionPolicy,
class F>
3332 void for_each(ExecutionPolicy&& policy, F&& fCallback)
const {
3334 std::forward<ExecutionPolicy>(policy),
sets_.begin(),
sets_.end(),
3335 [&](
auto const& inner) {
3336 typename Lockable::SharedLock m(const_cast<Inner&>(inner));
3337 std::for_each(inner.set_.begin(), inner.set_.end(), fCallback);
3342 template <
class ExecutionPolicy,
class F>
3343 void for_each_m(ExecutionPolicy&& policy, F&& fCallback) {
3345 std::forward<ExecutionPolicy>(policy),
sets_.begin(),
sets_.end(),
3347 typename Lockable::UniqueLock m(inner);
3348 std::for_each(inner.set_.begin(), inner.set_.end(), fCallback);
3362 const auto& set = inner.
set_;
3370 auto& set = inner.
set_;
3391 template <
class K = key_type>
3393 auto hashval = this->
hash(key);
3395 auto& set = inner.
set_;
3397 auto it = set.find(key, hashval);
3398 if (it == set.end())
3426 assert(inner !=
nullptr);
3427 auto& set = inner->
set_;
3441 while (first != last) {
3451 template <
typename E = Eq>
3453 assert(
this != &src);
3464 template <
typename E = Eq>
3475 typename std::enable_if<!std::is_same<K, iterator>::value,
int>::type = 0>
3477 auto it =
find(key);
3481 template<
class Mtx2_>
3483 noexcept(IsNoThrowSwappable<EmbeddedSet>() &&
3484 (!AllocTraits::propagate_on_container_swap::value ||
3485 IsNoThrowSwappable<allocator_type>()))
3493 typename Lockable2::UniqueLock l2(that.get_inner(i));
3494 swap(
sets_[i].set_, that.get_inner(i).set_);
3500 for (
auto& inner :
sets_)
3503 inner.set_.rehash(nn);
3511 rehash(normalized > target ? normalized : target);
3524 template <
class K = key_type>
3526 return find(key) ==
end() ? 0 : 1;
3537 const auto& set = inner.
set_;
3539 set.prefetch_hash(hashval);
3542 template <
class K = key_type>
3555 template <
class K = key_type>
3558 return find(key, hashval, m);
3561 template <
class K = key_type>
3566 template <
class K = key_type>
3571 template <
class K = key_type>
3576 template <
class K = key_type>
3581 template <
class K = key_type>
3583 return find(key, hashval) !=
end();
3586 template <
class K = key_type>
3588 auto it =
find(key);
3589 if (it !=
end())
return {it, std::next(it)};
3593 template <
class K = key_type>
3596 auto it =
find(key);
3597 if (it !=
end())
return {it, std::next(it)};
3603 for (
const auto& inner :
sets_)
3606 sz += inner.set_.bucket_count();
3613 return _capacity ?
static_cast<float>(
static_cast<double>(
size()) / _capacity) : 0;
3633 template<
class Mtx2_>
3636 noexcept(
noexcept(a.swap(b)))
3646#if !defined(PHMAP_NON_DETERMINISTIC)
3647 template<
typename OutputArchive>
3650 template<
typename InputArchive>
3655 template <
class Container,
typename Enabler>
3660 template <
class K,
class... Args>
3669 template <
class K,
class... Args>
3679 template <
class K2,
class... Args>
3681 return eq(lhs,
rhs);
3693 auto &it = cit.
iter_;
3694 assert(it.set_ !=
nullptr);
3699 for (
auto& inner :
sets_)
3702 inner.set_.drop_deletes_without_resize();
3709 auto& set = inner.set_;
3711 return set.has_element(elem, hashval);
3716 template<
class Mtx2_>
3723 template<
class Mtx2_>
3731 template <
class K = key_type,
class L =
typename Lockable::SharedLock>
3735 auto& set = inner.
set_;
3736 mutexlock = std::move(L(inner));
3737 return set.find_ptr(key, hashval);
3740 template <
class K = key_type,
class L =
typename Lockable::SharedLock>
3743 auto& set = inner.
set_;
3744 mutexlock = std::move(L(inner));
3749 std::tuple<Inner*, size_t, bool>
3752 auto& set = inner.
set_;
3754 auto p = set.find_or_prepare_insert(key, hashval);
3755 return std::make_tuple(&inner, p.first, p.second);
3759 std::tuple<Inner*, size_t, bool>
3761 return find_or_prepare_insert_with_hash<K>(this->
hash(key), key, mutexlock);
3774 return ((hashval >> 8) ^ (hashval >> 16) ^ (hashval >> 24)) &
mask;
3786 for (
const auto& set :
sets_)
3787 sz += set.growth_left();
3797 return sets_[0].set_.alloc_ref();
3807 template <
class,
class,
class,
class>
class RefSet,
3809 class Policy,
class Hash,
class Eq,
class Alloc>
3817 std::addressof(std::declval<typename parallel_hash_map::reference>())));
3822 std::addressof(std::declval<typename parallel_hash_map::const_reference>())));
3835 using key_arg =
typename KeyArgImpl::template type<K, key_type>;
3837 static_assert(!std::is_reference<key_type>::value,
"");
3840 static_assert(!std::is_reference<mapped_type>::value,
"");
3842 using iterator =
typename parallel_hash_map::parallel_hash_set::iterator;
3843 using const_iterator =
typename parallel_hash_map::parallel_hash_set::const_iterator;
3847#ifdef __INTEL_COMPILER
3848 using Base::parallel_hash_set;
3850 using parallel_hash_map::parallel_hash_set::parallel_hash_set;
3866 template <
class K = key_type,
class V = mapped_type, K* =
nullptr>
3871 template <
class K = key_type,
class V = mapped_type, V* =
nullptr>
3876 template <
class K = key_type,
class V = mapped_type>
3887 template <
class K = key_type,
class V = mapped_type, K* =
nullptr>
3892 template <
class K = key_type,
class V = mapped_type, V* =
nullptr>
3897 template <
class K = key_type,
class V = mapped_type>
3902 template <
class K =
key_type,
class... Args,
3903 typename std::enable_if<
3904 !std::is_convertible<K, const_iterator>::value,
int>::type = 0,
3910 template <
class K =
key_type,
class... Args,
3911 typename std::enable_if<
3912 !std::is_convertible<K, const_iterator>::value,
int>::type = 0>
3917 template <
class K =
key_type,
class... Args, K* =
nullptr>
3919 return try_emplace(std::forward<K>(k), std::forward<Args>(args)...).first;
3922 template <
class K =
key_type,
class... Args>
3924 return try_emplace(k, std::forward<Args>(args)...).first;
3927 template <
class K = key_type,
class P = Policy>
3929 auto it = this->
find(key);
3930 if (it == this->
end())
3932 return Policy::value(&*it);
3935 template <
class K = key_type,
class P = Policy>
3937 auto it = this->
find(key);
3938 if (it == this->
end())
3940 return Policy::value(&*it);
3945 template <
class K =
key_type,
class... Args,
3946 typename std::enable_if<
3947 !std::is_convertible<K, const_iterator>::value,
int>::type = 0,
3953 template <
class K =
key_type,
class... Args,
3954 typename std::enable_if<
3955 !std::is_convertible<K, const_iterator>::value,
int>::type = 0>
3960 template <
class K =
key_type,
class... Args, K* =
nullptr>
3965 template <
class K =
key_type,
class... Args>
3976 template <
class K =
key_type,
class F,
class... Args>
3980 typename Base::Inner *inner = std::get<0>(res);
3981 if (std::get<2>(res))
3982 inner->set_.emplace_at(std::get<1>(res), std::piecewise_construct,
3983 std::forward_as_tuple(std::forward<K>(k)),
3984 std::forward_as_tuple(std::forward<Args>(args)...));
3986 auto it = this->
iterator_at(inner, inner->set_.iterator_at(std::get<1>(res)));
3987 std::forward<F>(f)(
const_cast<value_type &
>(*it));
3989 return std::get<2>(res);
3994 template <
class K = key_type,
class P = Policy, K* =
nullptr>
3996 return Policy::value(&*
try_emplace(std::forward<K>(key)).first);
3999 template <
class K = key_type,
class P = Policy>
4006 template <
class K,
class V>
4010 typename Base::Inner *inner = std::get<0>(res);
4011 if (std::get<2>(res))
4012 inner->set_.emplace_at(std::get<1>(res), std::forward<K>(k), std::forward<V>(v));
4014 Policy::value(&*inner->set_.iterator_at(std::get<1>(res))) = std::forward<V>(v);
4015 return {this->
iterator_at(inner, inner->set_.iterator_at(std::get<1>(res))),
4019 template <
class K =
key_type,
class... Args>
4023 typename Base::Inner *inner = std::get<0>(res);
4024 if (std::get<2>(res))
4025 inner->set_.emplace_at(std::get<1>(res), std::piecewise_construct,
4026 std::forward_as_tuple(std::forward<K>(k)),
4027 std::forward_as_tuple(std::forward<Args>(args)...));
4028 return {this->
iterator_at(inner, inner->set_.iterator_at(std::get<1>(res))),
4032 template <
class K =
key_type,
class... Args>
4036 typename Base::Inner *inner = std::get<0>(res);
4037 if (std::get<2>(res))
4038 inner->set_.emplace_at(std::get<1>(res), std::piecewise_construct,
4039 std::forward_as_tuple(std::forward<K>(k)),
4040 std::forward_as_tuple(std::forward<Args>(args)...));
4041 return {this->
iterator_at(inner, inner->set_.iterator_at(std::get<1>(res))),
4052template <
class Alloc,
class T,
class Tuple>
4055 alloc, ptr, std::forward<Tuple>(t),
4057 std::tuple_size<
typename std::decay<Tuple>::type>::value>());
4063template <
class T,
class Tuple,
class F>
4066 return memory_internal::WithConstructedImpl<T>(
4067 std::forward<Tuple>(t),
4069 std::tuple_size<
typename std::decay<Tuple>::type>::value>(),
4070 std::forward<F>(f));
4086inline std::pair<std::tuple<>, std::tuple<>>
PairArgs() {
return {}; }
4088template <
class F,
class S>
4089std::pair<std::tuple<F&&>, std::tuple<S&&>>
PairArgs(F&& f, S&& s) {
4090 return {std::piecewise_construct, std::forward_as_tuple(std::forward<F>(f)),
4091 std::forward_as_tuple(std::forward<S>(s))};
4094template <
class F,
class S>
4095std::pair<std::tuple<const F&>, std::tuple<const S&>>
PairArgs(
4096 const std::pair<F, S>& p) {
4097 return PairArgs(p.first, p.second);
4100template <
class F,
class S>
4101std::pair<std::tuple<F&&>, std::tuple<S&&>>
PairArgs(std::pair<F, S>&& p) {
4102 return PairArgs(std::forward<F>(p.first), std::forward<S>(p.second));
4105template <
class F,
class S>
4115template <
class F,
class... Args>
4118 std::forward<F>(f),
PairArgs(std::forward<Args>(args)...))) {
4120 std::forward<F>(f),
PairArgs(std::forward<Args>(args)...));
4125template <
class F,
class Arg>
4126decltype(std::declval<F>()(std::declval<const Arg&>(), std::declval<Arg>()))
4128 const auto& key = arg;
4129 return std::forward<F>(f)(key, std::forward<Arg>(arg));
4160 template <
class Allocator,
class... Args>
4163 std::forward<Args>(args)...);
4166 template <
class Allocator>
4171 template <
class Allocator>
4174 construct(alloc, new_slot, std::move(*old_slot));
4180 template <
class F,
class... Args>
4182 std::declval<F>(), std::declval<Args>()...))
4185 std::forward<F>(f), std::forward<Args>(args)...);
4193template <
class K,
class V>
4202 template <
class Allocator,
class... Args>
4207 template <
class Allocator>
4212 template <
class Allocator>
4218 template <
class F,
class... Args>
4220 std::declval<F>(), std::declval<Args>()...))
4223 std::forward<Args>(args)...);
4230 static V&
value(std::pair<const K, V>* kv) {
return kv->second; }
4231 static const V&
value(
const std::pair<const K, V>* kv) {
return kv->second; }
4234template <
class Reference,
class Policy>
4236 static_assert(std::is_lvalue_reference<Reference>::value,
"");
4239 typename std::remove_reference<Reference>::type>::type*;
4241 template <
class Alloc,
class... Args>
4243 *slot = Policy::new_element(alloc, std::forward<Args>(args)...);
4246 template <
class Alloc>
4248 Policy::delete_element(alloc, *slot);
4251 template <
class Alloc>
4253 *new_slot = *old_slot;
4257 if (slot ==
nullptr)
return Policy::element_space_used(
nullptr);
4258 return Policy::element_space_used(*slot);
4263 template <
class T,
class P = Policy>
4264 static auto value(T* elem) ->
decltype(P::value(elem)) {
4265 return P::value(elem);
4268 template <
class... Ts,
class P = Policy>
4269 static auto apply(Ts&&... ts) ->
decltype(P::apply(std::forward<Ts>(ts)...)) {
4270 return P::apply(std::forward<Ts>(ts)...);
4284 template <
class Allocator,
class... Args>
4288 ValueAlloc value_alloc(*alloc);
4291 std::forward<Args>(args)...);
4295 template <
class Allocator>
4299 ValueAlloc value_alloc(*alloc);
4304 template <
class F,
class... Args>
4306 std::declval<F>(), std::declval<Args>()...))
4309 std::forward<F>(f), std::forward<Args>(args)...);
4317template <
class Key,
class Value>
4320 std::pair<const Key, Value>&, NodeHashMapPolicy<Key, Value>>
4329 template <
class Allocator,
class... Args>
4332 Allocator>::template rebind_alloc<value_type>;
4333 PairAlloc pair_alloc(*alloc);
4337 std::forward<Args>(args)...);
4341 template <
class Allocator>
4344 Allocator>::template rebind_alloc<value_type>;
4345 PairAlloc pair_alloc(*alloc);
4350 template <
class F,
class... Args>
4352 std::declval<F>(), std::declval<Args>()...))
4355 std::forward<Args>(args)...);
4371#if PHMAP_HAVE_STD_STRING_VIEW
4374template<
class CharT>
4379 using is_transparent = void;
4381 size_t operator()(std::basic_string_view<CharT> v)
const {
4382 std::string_view bv{
4383 reinterpret_cast<const char*
>(v.data()), v.size() *
sizeof(CharT)};
4384 return std::hash<std::string_view>()(bv);
4389 using is_transparent = void;
4391 bool operator()(std::basic_string_view<CharT> lhs,
4392 std::basic_string_view<CharT> rhs)
const {
4399struct HashEq<
std::
string> : StringHashEqT<char> {};
4402struct HashEq<
std::string_view> : StringHashEqT<char> {};
4406struct HashEq<
std::u16string> : StringHashEqT<char16_t> {};
4409struct HashEq<
std::u16string_view> : StringHashEqT<char16_t> {};
4413struct HashEq<
std::wstring> : StringHashEqT<wchar_t> {};
4416struct HashEq<
std::wstring_view> : StringHashEqT<wchar_t> {};
4435 template <
class A,
class B>
4437 return HashEq::ToPtr(a) == HashEq::ToPtr(b);
4442 static const T*
ToPtr(
const T* ptr) {
return ptr; }
4444 template <
class U,
class D>
4445 static const T*
ToPtr(
const std::unique_ptr<U, D>& ptr) {
4450 static const T*
ToPtr(
const std::shared_ptr<U>& ptr) {
4455template <
class T,
class D>
4461namespace hashtable_debug_internal {
4466template<
typename,
typename =
void >
4473template <
typename Set>
4477 using Slot =
typename Traits::slot_type;
4480 const typename Set::key_type& key) {
4481 size_t num_probes = 0;
4482 size_t hashval = set.hash(key);
4483 auto seq = set.probe(hashval);
4486 for (uint32_t i : g.Match(
priv::H2(hashval))) {
4488 typename Set::template EqualElement<typename Set::key_type>{
4490 Traits::element(set.slots_ + seq.offset((
size_t)i))))
4494 if (g.MatchEmpty())
return num_probes;
4501 size_t capacity = c.capacity_;
4502 if (capacity == 0)
return 0;
4503 auto layout = Set::MakeLayout(capacity);
4504 size_t m = layout.AllocSize();
4506 size_t per_slot = Traits::space_used(
static_cast<const Slot*
>(
nullptr));
4507 if (per_slot != ~
size_t{}) {
4508 m += per_slot * c.size();
4510 for (
size_t i = 0; i != capacity; ++i) {
4512 m += Traits::space_used(c.slots_ + i);
4521 if (capacity == 0)
return 0;
4523 size_t m = layout.AllocSize();
4524 size_t per_slot = Traits::space_used(
static_cast<const Slot*
>(
nullptr));
4525 if (per_slot != ~
size_t{}) {
4526 m += per_slot * size;
4533template<
typename,
typename =
void >
4540template <
typename Set>
4543 using Slot =
typename Traits::slot_type;
4546 static size_t GetNumProbes(
const Set& set,
const typename Set::key_type& key) {
4547 size_t hashval = set.hash(key);
4548 auto& inner = set.sets_[set.subidx(hashval)];
4549 auto& inner_set = inner.set_;
4574template <
class T,
class Hash,
class Eq,
class Alloc>
4577 phmap::priv::FlatHashSetPolicy<T>, Hash, Eq, Alloc>
4583#ifdef __INTEL_COMPILER
4584 using Base::raw_hash_set;
4592 using Base::capacity;
4594 using Base::max_size;
4599 using Base::emplace;
4600 using Base::emplace_hint;
4601 using Base::extract;
4605 using Base::reserve;
4606 using Base::contains;
4608 using Base::equal_range;
4610 using Base::bucket_count;
4611 using Base::load_factor;
4612 using Base::max_load_factor;
4613 using Base::get_allocator;
4614 using Base::hash_function;
4637template <
class K,
class V,
class Hash,
class Eq,
class Alloc>
4639 phmap::priv::FlatHashMapPolicy<K, V>,
4645#ifdef __INTEL_COMPILER
4646 using Base::raw_hash_map;
4654 using Base::capacity;
4656 using Base::max_size;
4661 using Base::insert_or_assign;
4662 using Base::emplace;
4663 using Base::emplace_hint;
4664 using Base::try_emplace;
4665 using Base::extract;
4669 using Base::reserve;
4671 using Base::contains;
4673 using Base::equal_range;
4675 using Base::operator[];
4676 using Base::bucket_count;
4677 using Base::load_factor;
4678 using Base::max_load_factor;
4679 using Base::get_allocator;
4680 using Base::hash_function;
4700template <
class T,
class Hash,
class Eq,
class Alloc>
4703 phmap::priv::NodeHashSetPolicy<T>, Hash, Eq, Alloc>
4709#ifdef __INTEL_COMPILER
4710 using Base::raw_hash_set;
4718 using Base::capacity;
4720 using Base::max_size;
4725 using Base::emplace;
4726 using Base::emplace_hint;
4727 using Base::emplace_with_hash;
4728 using Base::emplace_hint_with_hash;
4729 using Base::extract;
4733 using Base::reserve;
4734 using Base::contains;
4736 using Base::equal_range;
4738 using Base::bucket_count;
4739 using Base::load_factor;
4740 using Base::max_load_factor;
4741 using Base::get_allocator;
4742 using Base::hash_function;
4765template <
class Key,
class Value,
class Hash,
class Eq,
class Alloc>
4768 phmap::priv::NodeHashMapPolicy<Key, Value>, Hash, Eq,
4775#ifdef __INTEL_COMPILER
4776 using Base::raw_hash_map;
4784 using Base::capacity;
4786 using Base::max_size;
4791 using Base::insert_or_assign;
4792 using Base::emplace;
4793 using Base::emplace_hint;
4794 using Base::try_emplace;
4795 using Base::extract;
4799 using Base::reserve;
4801 using Base::contains;
4803 using Base::equal_range;
4805 using Base::operator[];
4806 using Base::bucket_count;
4807 using Base::load_factor;
4808 using Base::max_load_factor;
4809 using Base::get_allocator;
4810 using Base::hash_function;
4820template <
class T,
class Hash,
class Eq,
class Alloc,
size_t N,
class Mtx_>
4823 N, phmap::priv::raw_hash_set, Mtx_,
4824 phmap::priv::FlatHashSetPolicy<T>,
4831#ifdef __INTEL_COMPILER
4832 using Base::parallel_hash_set;
4843 using Base::capacity;
4845 using Base::max_size;
4850 using Base::emplace;
4851 using Base::emplace_hint;
4852 using Base::emplace_with_hash;
4853 using Base::emplace_hint_with_hash;
4854 using Base::extract;
4858 using Base::reserve;
4859 using Base::contains;
4861 using Base::equal_range;
4863 using Base::bucket_count;
4864 using Base::load_factor;
4865 using Base::max_load_factor;
4866 using Base::get_allocator;
4867 using Base::hash_function;
4874template <
class K,
class V,
class Hash,
class Eq,
class Alloc,
size_t N,
class Mtx_>
4876 N, phmap::priv::raw_hash_set, Mtx_,
4877 phmap::priv::FlatHashMapPolicy<K, V>,
4884#ifdef __INTEL_COMPILER
4885 using Base::parallel_hash_map;
4896 using Base::capacity;
4898 using Base::max_size;
4903 using Base::insert_or_assign;
4904 using Base::emplace;
4905 using Base::emplace_hint;
4906 using Base::try_emplace;
4907 using Base::emplace_with_hash;
4908 using Base::emplace_hint_with_hash;
4909 using Base::try_emplace_with_hash;
4910 using Base::extract;
4914 using Base::reserve;
4916 using Base::contains;
4918 using Base::equal_range;
4920 using Base::operator[];
4921 using Base::bucket_count;
4922 using Base::load_factor;
4923 using Base::max_load_factor;
4924 using Base::get_allocator;
4925 using Base::hash_function;
4932template <
class T,
class Hash,
class Eq,
class Alloc,
size_t N,
class Mtx_>
4935 N, phmap::priv::raw_hash_set, Mtx_,
4936 phmap::priv::NodeHashSetPolicy<T>, Hash, Eq, Alloc>
4942#ifdef __INTEL_COMPILER
4943 using Base::parallel_hash_set;
4954 using Base::capacity;
4956 using Base::max_size;
4961 using Base::emplace;
4962 using Base::emplace_hint;
4963 using Base::emplace_with_hash;
4964 using Base::emplace_hint_with_hash;
4965 using Base::extract;
4969 using Base::reserve;
4970 using Base::contains;
4972 using Base::equal_range;
4974 using Base::bucket_count;
4975 using Base::load_factor;
4976 using Base::max_load_factor;
4977 using Base::get_allocator;
4978 using Base::hash_function;
4987template <
class Key,
class Value,
class Hash,
class Eq,
class Alloc,
size_t N,
class Mtx_>
4990 N, phmap::priv::raw_hash_set, Mtx_,
4991 phmap::priv::NodeHashMapPolicy<Key, Value>, Hash, Eq,
4998#ifdef __INTEL_COMPILER
4999 using Base::parallel_hash_map;
5010 using Base::capacity;
5012 using Base::max_size;
5017 using Base::insert_or_assign;
5018 using Base::emplace;
5019 using Base::emplace_hint;
5020 using Base::try_emplace;
5021 using Base::emplace_with_hash;
5022 using Base::emplace_hint_with_hash;
5023 using Base::try_emplace_with_hash;
5024 using Base::extract;
5028 using Base::reserve;
5030 using Base::contains;
5032 using Base::equal_range;
5034 using Base::operator[];
5035 using Base::bucket_count;
5036 using Base::load_factor;
5037 using Base::max_load_factor;
5038 using Base::get_allocator;
5039 using Base::hash_function;
5050 template <
class C,
class Pred>
5052 auto old_size = c.size();
5053 for (
auto i = c.begin(), last = c.end(); i != last; ) {
5060 return old_size - c.size();
5065 template <
class T,
class Hash,
class Eq,
class Alloc,
class Pred>
5070 template <
class T,
class Hash,
class Eq,
class Alloc,
class Pred>
5075 template <
class T,
class Hash,
class Eq,
class Alloc,
size_t N,
class Mtx_,
class Pred>
5080 template <
class T,
class Hash,
class Eq,
class Alloc,
size_t N,
class Mtx_,
class Pred>
5086 template <
class K,
class V,
class Hash,
class Eq,
class Alloc,
class Pred>
5091 template <
class K,
class V,
class Hash,
class Eq,
class Alloc,
class Pred>
5096 template <
class K,
class V,
class Hash,
class Eq,
class Alloc,
size_t N,
class Mtx_,
class Pred>
5101 template <
class K,
class V,
class Hash,
class Eq,
class Alloc,
size_t N,
class Mtx_,
class Pred>
5109 #pragma warning(pop)
Definition: phmap_base.h:5037
typename Base::WriteLock UpgradeLock
Definition: phmap_base.h:5042
typename Base::WriteLock SharedLock
Definition: phmap_base.h:5041
typename Base::DoNothing UpgradeToUnique
Definition: phmap_base.h:5046
typename Base::WriteLocks UniqueLocks
Definition: phmap_base.h:5045
typename Base::WriteLocks SharedLocks
Definition: phmap_base.h:5044
typename Base::WriteLock UniqueLock
Definition: phmap_base.h:5043
typename flat_hash_map::raw_hash_map Base
Definition: phmap.h:4641
flat_hash_map()
Definition: phmap.h:4644
flat_hash_set()
Definition: phmap.h:4582
typename flat_hash_set::raw_hash_set Base
Definition: phmap.h:4579
node_hash_map()
Definition: phmap.h:4774
typename node_hash_map::raw_hash_map Base
Definition: phmap.h:4771
void resize(typename Base::size_type hint)
Definition: phmap.h:4814
Base::hasher hash_funct()
Definition: phmap.h:4813
typename node_hash_set::raw_hash_set Base
Definition: phmap.h:4705
void resize(typename Base::size_type hint)
Definition: phmap.h:4746
node_hash_set()
Definition: phmap.h:4708
Base::hasher hash_funct()
Definition: phmap.h:4745
parallel_flat_hash_map()
Definition: phmap.h:4883
typename parallel_flat_hash_map::parallel_hash_map Base
Definition: phmap.h:4880
typename parallel_flat_hash_set::parallel_hash_set Base
Definition: phmap.h:4827
parallel_flat_hash_set()
Definition: phmap.h:4830
parallel_node_hash_map()
Definition: phmap.h:4997
Base::hasher hash_funct()
Definition: phmap.h:5041
typename parallel_node_hash_map::parallel_hash_map Base
Definition: phmap.h:4994
void resize(typename Base::size_type hint)
Definition: phmap.h:5042
parallel_node_hash_set()
Definition: phmap.h:4941
void resize(typename Base::size_type hint)
Definition: phmap.h:4981
Base::hasher hash_funct()
Definition: phmap.h:4980
typename parallel_node_hash_set::parallel_hash_set Base
Definition: phmap.h:4938
BitMask & operator++()
Definition: phmap.h:243
friend bool operator!=(const BitMask &a, const BitMask &b)
Definition: phmap.h:276
BitMask begin() const
Definition: phmap.h:259
T mask_
Definition: phmap.h:280
BitMask end() const
Definition: phmap.h:260
uint32_t HighestBitSet() const
Definition: phmap.h:255
friend bool operator==(const BitMask &a, const BitMask &b)
Definition: phmap.h:273
uint32_t LeadingZeros() const
Definition: phmap.h:266
uint32_t operator*() const
Definition: phmap.h:249
uint32_t LowestBitSet() const
Definition: phmap.h:251
uint32_t TrailingZeros() const
Definition: phmap.h:262
BitMask(T mask)
Definition: phmap.h:241
int value_type
Definition: phmap.h:237
Definition: phmap_base.h:4286
friend void swap(HashtablezInfoHandle &, HashtablezInfoHandle &) noexcept
Definition: phmap.h:673
void RecordInsert(size_t, size_t)
Definition: phmap.h:671
void RecordStorageChanged(size_t, size_t)
Definition: phmap.h:669
void RecordErase()
Definition: phmap.h:672
void RecordRehash(size_t)
Definition: phmap.h:670
void Unregister(HashtablezInfo *)
Definition: phmap.h:685
void(*)(const HashtablezInfo &) DisposeCallback
Definition: phmap.h:687
int64_t Iterate(const std::function< void(const HashtablezInfo &stack)> &)
Definition: phmap.h:689
DisposeCallback SetDisposeCallback(DisposeCallback)
Definition: phmap.h:688
HashtablezInfo * Register()
Definition: phmap.h:684
static HashtablezSampler & Global()
Definition: phmap.h:683
Definition: phmap_base.h:4129
Value mapped_type
Definition: phmap.h:4326
static size_t element_space_used(const value_type *)
Definition: phmap.h:4358
static void delete_element(Allocator *alloc, value_type *pair)
Definition: phmap.h:4342
std::pair< const Key, Value > value_type
Definition: phmap.h:4322
Key key_type
Definition: phmap.h:4325
static const Value & value(const value_type *elem)
Definition: phmap.h:4363
static Value & value(value_type *elem)
Definition: phmap.h:4362
static value_type * new_element(Allocator *alloc, Args &&... args)
Definition: phmap.h:4330
static decltype(phmap::priv::DecomposePair(std::declval< F >(), std::declval< Args >()...)) apply(F &&f, Args &&... args)
Definition: phmap.h:4353
std::pair< key_type, mapped_type > init_type
Definition: phmap.h:4327
Definition: phmap_base.h:2833
MappedReference< P > operator[](const key_arg< K > &key)
Definition: phmap.h:4000
std::pair< iterator, bool > try_emplace_impl(K &&k, Args &&... args)
Definition: phmap.h:4020
std::pair< iterator, bool > try_emplace(const key_arg< K > &k, Args &&... args)
Definition: phmap.h:3913
std::pair< iterator, bool > insert_or_assign(key_arg< K > &&k, const V &v)
Definition: phmap.h:3867
iterator try_emplace(const_iterator, const key_arg< K > &k, Args &&... args)
Definition: phmap.h:3923
parallel_hash_map()
Definition: phmap.h:3845
iterator insert_or_assign(const_iterator, key_arg< K > &&k, const V &v)
Definition: phmap.h:3888
std::pair< iterator, bool > insert_or_assign(key_arg< K > &&k, V &&v)
Definition: phmap.h:3862
typename Base::value_type value_type
Definition: phmap.h:3833
std::pair< iterator, bool > try_emplace_with_hash(size_t hashval, const key_arg< K > &k, Args &&... args)
Definition: phmap.h:3956
typename Policy::key_type key_type
Definition: phmap.h:3831
iterator try_emplace(const_iterator, key_arg< K > &&k, Args &&... args)
Definition: phmap.h:3918
MappedReference< P > at(const key_arg< K > &key)
Definition: phmap.h:3928
std::pair< iterator, bool > try_emplace_with_hash(size_t hashval, key_arg< K > &&k, Args &&... args)
Definition: phmap.h:3949
iterator insert_or_assign(const_iterator, key_arg< K > &&k, V &&v)
Definition: phmap.h:3883
iterator try_emplace_with_hash(size_t hashval, const_iterator, key_arg< K > &&k, Args &&... args)
Definition: phmap.h:3961
std::pair< iterator, bool > try_emplace(key_arg< K > &&k, Args &&... args)
Definition: phmap.h:3906
typename Policy::mapped_type mapped_type
Definition: phmap.h:3832
typename parallel_hash_map::parallel_hash_set Base
Definition: phmap.h:3827
std::pair< iterator, bool > try_emplace_impl_with_hash(size_t hashval, K &&k, Args &&... args)
Definition: phmap.h:4033
bool try_emplace_l(K &&k, F &&f, Args &&... args)
Definition: phmap.h:3977
iterator insert_or_assign(const_iterator, const key_arg< K > &k, V &&v)
Definition: phmap.h:3893
typename parallel_hash_map::parallel_hash_set::iterator iterator
Definition: phmap.h:3842
typename KeyArgImpl::template type< K, key_type > key_arg
Definition: phmap.h:3835
std::pair< iterator, bool > insert_or_assign_impl(K &&k, V &&v)
Definition: phmap.h:4007
std::pair< iterator, bool > insert_or_assign(const key_arg< K > &k, const V &v)
Definition: phmap.h:3877
MappedConstReference< P > at(const key_arg< K > &key) const
Definition: phmap.h:3936
iterator insert_or_assign(const_iterator, const key_arg< K > &k, const V &v)
Definition: phmap.h:3898
iterator try_emplace_with_hash(size_t hashval, const_iterator, const key_arg< K > &k, Args &&... args)
Definition: phmap.h:3966
MappedReference< P > operator[](key_arg< K > &&key)
Definition: phmap.h:3995
typename parallel_hash_map::parallel_hash_set::const_iterator const_iterator
Definition: phmap.h:3843
std::pair< iterator, bool > insert_or_assign(const key_arg< K > &k, V &&v)
Definition: phmap.h:3872
decltype(P::value(std::addressof(std::declval< typename parallel_hash_map::reference >()))) MappedReference
Definition: phmap.h:3817
decltype(P::value(std::addressof(std::declval< typename parallel_hash_map::const_reference >()))) MappedConstReference
Definition: phmap.h:3822
reference operator*() const
Definition: phmap.h:2695
const_iterator operator++(int)
Definition: phmap.h:2702
typename iterator::iterator_category iterator_category
Definition: phmap.h:2684
typename parallel_hash_set::difference_type difference_type
Definition: phmap.h:2688
const_iterator(iterator i)
Definition: phmap.h:2693
typename parallel_hash_set::value_type value_type
Definition: phmap.h:2685
typename parallel_hash_set::const_pointer pointer
Definition: phmap.h:2687
friend bool operator!=(const const_iterator &a, const const_iterator &b)
Definition: phmap.h:2707
iterator iter_
Definition: phmap.h:2717
const_iterator & operator++()
Definition: phmap.h:2698
const_iterator()
Definition: phmap.h:2691
friend bool operator==(const const_iterator &a, const const_iterator &b)
Definition: phmap.h:2704
const_iterator(const Inner *inner, const Inner *inner_end, const EmbeddedIterator &it)
Definition: phmap.h:2712
typename parallel_hash_set::Inner Inner
Definition: phmap.h:2689
pointer operator->() const
Definition: phmap.h:2696
typename parallel_hash_set::const_reference reference
Definition: phmap.h:2686
typename parallel_hash_set::Inner Inner
Definition: phmap.h:2621
phmap::remove_reference_t< reference > * pointer
Definition: phmap.h:2619
iterator()
Definition: phmap.h:2625
std::forward_iterator_tag iterator_category
Definition: phmap.h:2614
phmap::conditional_t< PolicyTraits::constant_iterators::value, const value_type &, value_type & > reference
Definition: phmap.h:2618
Inner * inner_
Definition: phmap.h:2673
iterator & operator++()
Definition: phmap.h:2630
typename parallel_hash_set::EmbeddedSet EmbeddedSet
Definition: phmap.h:2622
friend bool operator!=(const iterator &a, const iterator &b)
Definition: phmap.h:2648
void skip_empty()
Definition: phmap.h:2659
EmbeddedIterator it_
Definition: phmap.h:2675
reference operator*() const
Definition: phmap.h:2627
typename parallel_hash_set::difference_type difference_type
Definition: phmap.h:2620
iterator operator++(int)
Definition: phmap.h:2637
friend bool operator==(const iterator &a, const iterator &b)
Definition: phmap.h:2644
pointer operator->() const
Definition: phmap.h:2628
iterator(Inner *inner, Inner *inner_end, const EmbeddedIterator &it)
Definition: phmap.h:2653
typename EmbeddedSet::iterator EmbeddedIterator
Definition: phmap.h:2623
typename parallel_hash_set::value_type value_type
Definition: phmap.h:2615
Inner * inner_end_
Definition: phmap.h:2674
EmbeddedIterator it_end_
Definition: phmap.h:2675
friend void swap(parallel_hash_set &a, parallel_hash_set< N, RefSet, Mtx2_, Policy, Hash, Eq, Alloc > &b) noexcept(noexcept(a.swap(b)))
Definition: phmap.h:3634
friend bool operator==(const parallel_hash_set &a, const parallel_hash_set &b)
Definition: phmap.h:3625
bool erase_if_impl(const key_arg< K > &key, F &&f)
Definition: phmap.h:3271
~parallel_hash_set()
Definition: phmap.h:2883
void _erase(iterator it)
Definition: phmap.h:3424
parallel_hash_set(InputIter first, InputIter last, size_t bucket_cnt, const allocator_type &alloc)
Definition: phmap.h:2778
bool has_element(const value_type &elem) const
Definition: phmap.h:3706
std::pair< iterator, bool > insert(init_type &&value)
Definition: phmap.h:2972
allocator_type & alloc_ref()
Definition: phmap.h:3795
bool contains(const key_arg< K > &key) const
Definition: phmap.h:3577
parallel_hash_set(std::initializer_list< init_type > init, size_t bucket_cnt, const allocator_type &alloc)
Definition: phmap.h:2833
iterator emplace_hint_with_hash(size_t hashval, const_iterator, Args &&... args)
Definition: phmap.h:3101
size_t count(const key_arg< K > &key) const
Definition: phmap.h:3525
void insert(std::initializer_list< init_type > ilist)
Definition: phmap.h:3008
size_t size() const
Definition: phmap.h:2899
auto KeyTypeCanBeHashed(const Hash &h, const key_type &k) -> decltype(h(k))
const hasher & hash_ref() const
Definition: phmap.h:3792
void emplace_single_with_hash(const key_arg< K > &key, size_t hashval, F &&f)
Definition: phmap.h:3206
const_iterator end() const
Definition: phmap.h:2893
parallel_hash_set(const allocator_type &alloc)
Definition: phmap.h:2761
const value_type & const_reference
Definition: phmap.h:2523
parallel_hash_set(std::initializer_list< T > init, size_t bucket_cnt, const allocator_type &alloc)
Definition: phmap.h:2829
const key_equal & eq_ref() const
Definition: phmap.h:3794
auto KeyTypeCanBeEq(const Eq &eq, const key_type &k) -> decltype(eq(k, k))
iterator find(const key_arg< K > &key)
Definition: phmap.h:3562
void rehash(size_t n)
Definition: phmap.h:3498
allocator_type get_allocator() const
Definition: phmap.h:3623
typename PolicyTraits::slot_type slot_type
Definition: phmap.h:2514
void for_each_m(F &&fCallback)
Definition: phmap.h:3323
std::pair< iterator, bool > make_rv(Inner *inner, const std::pair< EmbeddedIterator, bool > &res)
Definition: phmap.h:3186
void erase_meta_only(const_iterator cit)
Definition: phmap.h:3692
iterator erase(iterator it)
Definition: phmap.h:3438
parallel_hash_set & move_assign(parallel_hash_set< N, RefSet, Mtx2_, Policy, Hash, Eq, Alloc > &&that, std::true_type)
Definition: phmap.h:3717
typename EmbeddedSet::iterator EmbeddedIterator
Definition: phmap.h:2509
parallel_hash_set(InputIter first, InputIter last, size_t bucket_cnt, const hasher &hash_param, const allocator_type &alloc)
Definition: phmap.h:2773
parallel_hash_set(parallel_hash_set &&that) noexcept(std::is_nothrow_copy_constructible< hasher >::value &&std::is_nothrow_copy_constructible< key_equal >::value &&std::is_nothrow_copy_constructible< allocator_type >::value)
Definition: phmap.h:2855
size_type erase(const key_arg< K > &key)
Definition: phmap.h:3392
iterator make_iterator(Inner *inner, const EmbeddedIterator it)
Definition: phmap.h:3179
const_iterator iterator_at(Inner *inner, const EmbeddedIterator &it) const
Definition: phmap.h:3768
size_t size_type
Definition: phmap.h:2516
IsDecomposable< void, PolicyTraits, Hash, Eq, Ts... > IsDecomposable
Definition: phmap.h:2600
iterator insert(const_iterator, const T &value)
Definition: phmap.h:2990
iterator emplace_hint(const_iterator, Args &&... args)
Definition: phmap.h:3175
node_type extract(const key_arg< K > &key)
Definition: phmap.h:3476
key_equal key_eq() const
Definition: phmap.h:3622
void insert(InputIt first, InputIt last)
Definition: phmap.h:2999
std::pair< iterator, bool > emplace_decomposable(const K &key, Args &&... args)
Definition: phmap.h:3118
insert_return_type insert(node_type &&node)
Definition: phmap.h:3012
Policy policy_type
Definition: phmap.h:2520
parallel_hash_set(std::initializer_list< T > init, const allocator_type &alloc)
Definition: phmap.h:2838
const allocator_type & alloc_ref() const
Definition: phmap.h:3796
void prefetch_hash(size_t hashval) const
Definition: phmap.h:3535
parallel_hash_set & operator=(parallel_hash_set &&that) noexcept(phmap::allocator_traits< allocator_type >::is_always_equal::value &&std::is_nothrow_move_assignable< hasher >::value &&std::is_nothrow_move_assignable< key_equal >::value)
Definition: phmap.h:2874
const_iterator cend() const
Definition: phmap.h:2895
parallel_hash_set(std::initializer_list< init_type > init, size_t bucket_cnt=0, const hasher &hash_param=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
Definition: phmap.h:2814
Eq key_equal
Definition: phmap.h:2519
parallel_hash_set & operator=(const parallel_hash_set &that)
Definition: phmap.h:2868
value_type & reference
Definition: phmap.h:2522
size_t hash(const K &key) const
Definition: phmap.h:3642
hasher hash_function() const
Definition: phmap.h:3621
bool modify_if_impl(const key_arg< K > &key, F &&f)
Definition: phmap.h:3248
static size_t subcnt()
Definition: phmap.h:3777
parallel_hash_set(const parallel_hash_set &that, const allocator_type &a)
Definition: phmap.h:2849
typename phmap::allocator_traits< allocator_type >::template rebind_traits< value_type >::pointer pointer
Definition: phmap.h:2525
typename std::enable_if< phmap::disjunction< std::is_convertible< T, init_type >, SameAsElementReference< T > >::value, int >::type RequiresInsertable
Definition: phmap.h:2591
parallel_hash_set(parallel_hash_set &&that, const allocator_type &a)
Definition: phmap.h:2862
typename PolicyTraits::value_type value_type
Definition: phmap.h:2521
Alloc allocator_type
Definition: phmap.h:2515
iterator insert(const_iterator, init_type &&value)
Definition: phmap.h:2994
parallel_hash_set(std::initializer_list< T > init, size_t bucket_cnt, const hasher &hash_param, const allocator_type &alloc)
Definition: phmap.h:2820
node_handle< Policy, hash_policy_traits< Policy >, Alloc > node_type
Definition: phmap.h:2720
pointer find_ptr(const key_arg< K > &key, size_t hashval, L &mutexlock)
Definition: phmap.h:3732
std::tuple< Inner *, size_t, bool > find_or_prepare_insert_with_hash(size_t hashval, const K &key, typename Lockable::UniqueLock &mutexlock)
Definition: phmap.h:3750
std::pair< iterator, iterator > equal_range(const key_arg< K > &key)
Definition: phmap.h:3587
std::pair< iterator, bool > emplace_decomposable_with_hash(const K &key, size_t hashval, Args &&... args)
Definition: phmap.h:3045
void emplace_single(const key_arg< K > &key, F &&f)
Definition: phmap.h:3214
key_equal & eq_ref()
Definition: phmap.h:3793
const_iterator find(const key_arg< K > &key) const
Definition: phmap.h:3572
iterator lazy_emplace_with_hash(const key_arg< K > &key, size_t hashval, F &&f)
Definition: phmap.h:3106
bool contains(const key_arg< K > &key, size_t hashval) const
Definition: phmap.h:3582
const_iterator cbegin() const
Definition: phmap.h:2894
bool lazy_emplace_l(const key_arg< K > &key, FExists &&fExists, FEmplace &&fEmplace)
Definition: phmap.h:3293
friend bool operator!=(const parallel_hash_set &a, const parallel_hash_set &b)
Definition: phmap.h:3629
Inner & get_inner(size_t idx)
Definition: phmap.h:3376
const_iterator begin() const
Definition: phmap.h:2892
size_t capacity() const
Definition: phmap.h:2906
hasher & hash_ref()
Definition: phmap.h:3791
std::pair< iterator, bool > emplace(Args &&... args)
Definition: phmap.h:3148
void drop_deletes_without_resize() PHMAP_ATTRIBUTE_NOINLINE
Definition: phmap.h:3698
hash_policy_traits< Policy > PolicyTraits
Definition: phmap.h:2499
parallel_hash_set(std::initializer_list< init_type > init, size_t bucket_cnt, const hasher &hash_param, const allocator_type &alloc)
Definition: phmap.h:2824
iterator find(const key_arg< K > &key, size_t hashval, L &mutexlock)
Definition: phmap.h:3741
size_t max_size() const
Definition: phmap.h:2913
std::array< Inner, num_tables > sets_
Definition: phmap.h:3801
parallel_hash_set() noexcept(std::is_nothrow_default_constructible< hasher >::value &&std::is_nothrow_default_constructible< key_equal >::value &&std::is_nothrow_default_constructible< allocator_type >::value)
Definition: phmap.h:2725
void _erase(const_iterator cit)
Definition: phmap.h:3432
PHMAP_ATTRIBUTE_REINITIALIZES void clear()
Definition: phmap.h:2915
void merge(parallel_hash_set< N, RefSet, Mtx_, Policy, Hash, E, Alloc > &&src)
Definition: phmap.h:3465
void swap(parallel_hash_set< N, RefSet, Mtx2_, Policy, Hash, Eq, Alloc > &that) noexcept(IsNoThrowSwappable< EmbeddedSet >() &&(!AllocTraits::propagate_on_container_swap::value||IsNoThrowSwappable< allocator_type >()))
Definition: phmap.h:3482
iterator erase(const_iterator first, const_iterator last)
Definition: phmap.h:3440
void with_submap_m(size_t idx, F &&fCallback)
Definition: phmap.h:3368
friend struct RawHashSetTestOnlyAccess
Definition: phmap.h:3782
size_t growth_left()
Definition: phmap.h:3784
bool if_contains_unsafe(const key_arg< K > &key, F &&f) const
Definition: phmap.h:3233
bool if_contains(const key_arg< K > &key, F &&f) const
Definition: phmap.h:3223
std::tuple< Inner *, size_t, bool > find_or_prepare_insert(const K &key, typename Lockable::UniqueLock &mutexlock)
Definition: phmap.h:3760
typename EmbeddedSet::constructor constructor
Definition: phmap.h:2511
iterator iterator_at(Inner *inner, const EmbeddedIterator &it)
Definition: phmap.h:3764
iterator lazy_emplace(const key_arg< K > &key, F &&f)
Definition: phmap.h:3195
typename EmbeddedSet::const_iterator EmbeddedConstIterator
Definition: phmap.h:2510
bool phmap_load(InputArchive &ar)
Definition: phmap_dump.h:115
void prefetch(const key_arg< K > &key) const
Definition: phmap.h:3543
void max_load_factor(float)
Definition: phmap.h:3617
static size_t subidx(size_t hashval)
Definition: phmap.h:3773
parallel_hash_set(std::initializer_list< init_type > init, const allocator_type &alloc)
Definition: phmap.h:2841
parallel_hash_set(size_t bucket_cnt, const hasher &hash_param, const allocator_type &alloc)
Definition: phmap.h:2753
iterator erase(const_iterator cit)
Definition: phmap.h:3407
static constexpr size_t mask
Definition: phmap.h:2505
parallel_hash_set(InputIter first, InputIter last, size_t bucket_cnt=0, const hasher &hash_param=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
Definition: phmap.h:2765
bool modify_if(const key_arg< K > &key, F &&f)
Definition: phmap.h:3242
node_type extract(const_iterator position)
Definition: phmap.h:3469
iterator insert(const_iterator, node_type &&node)
Definition: phmap.h:3027
std::pair< const_iterator, const_iterator > equal_range(const key_arg< K > &key) const
Definition: phmap.h:3594
typename std::enable_if<!std::is_same< T, init_type >::value, int >::type RequiresNotInit
Definition: phmap.h:2597
const_iterator find(const key_arg< K > &key, size_t hashval) const
Definition: phmap.h:3567
parallel_hash_set(size_t bucket_cnt, const allocator_type &alloc)
Definition: phmap.h:2758
iterator begin()
Definition: phmap.h:2885
static constexpr size_t num_tables
Definition: phmap.h:2504
parallel_hash_set & move_assign(parallel_hash_set< N, RefSet, Mtx2_, Policy, Hash, Eq, Alloc > &&that, std::false_type)
Definition: phmap.h:3724
void with_submap(size_t idx, F &&fCallback) const
Definition: phmap.h:3360
typename PolicyTraits::key_type key_type
Definition: phmap.h:2513
parallel_hash_set(size_t bucket_cnt, const hasher &hash_param=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
Definition: phmap.h:2744
void for_each(F &&fCallback) const
Definition: phmap.h:3314
std::pair< iterator, bool > emplace_with_hash(size_t hashval, Args &&... args)
Definition: phmap.h:3075
RefSet< Policy, Hash, Eq, Alloc > EmbeddedSet
Definition: phmap.h:2508
float load_factor() const
Definition: phmap.h:3611
float max_load_factor() const
Definition: phmap.h:3616
typename phmap::allocator_traits< allocator_type >::template rebind_traits< value_type >::const_pointer const_pointer
Definition: phmap.h:2527
bool phmap_dump(OutputArchive &ar) const
Definition: phmap_dump.h:93
typename KeyArgImpl::template type< K, key_type > key_arg
Definition: phmap.h:2535
void insert(std::initializer_list< T > ilist)
Definition: phmap.h:3004
iterator find(const key_arg< K > &key, size_t hashval)
Definition: phmap.h:3556
bool erase_if(const key_arg< K > &key, F &&f)
Definition: phmap.h:3266
iterator insert(const_iterator, T &&value)
Definition: phmap.h:2979
parallel_hash_set(std::initializer_list< T > init, size_t bucket_cnt=0, const hasher &hash_param=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
Definition: phmap.h:2809
parallel_hash_set(InputIter first, InputIter last, const allocator_type &alloc)
Definition: phmap.h:2783
Hash hasher
Definition: phmap.h:2518
size_t bucket_count() const
Definition: phmap.h:3601
std::pair< iterator, bool > insert(T &&value)
Definition: phmap.h:2940
std::pair< iterator, bool > insert(const T &value)
Definition: phmap.h:2962
iterator end()
Definition: phmap.h:2891
ptrdiff_t difference_type
Definition: phmap.h:2517
void clear(std::size_t submap_index)
Definition: phmap.h:2925
parallel_hash_set(const parallel_hash_set &that)
Definition: phmap.h:2845
typename PolicyTraits::init_type init_type
Definition: phmap.h:2512
void reserve(size_t n)
Definition: phmap.h:3507
void merge(parallel_hash_set< N, RefSet, Mtx_, Policy, Hash, E, Alloc > &src)
Definition: phmap.h:3452
bool empty() const
Definition: phmap.h:2897
void next()
Definition: phmap.h:155
size_t getindex() const
Definition: phmap.h:161
size_t offset_
Definition: phmap.h:165
size_t offset(size_t i) const
Definition: phmap.h:153
size_t mask_
Definition: phmap.h:164
size_t index_
Definition: phmap.h:166
size_t offset() const
Definition: phmap.h:152
probe_seq(size_t hashval, size_t mask)
Definition: phmap.h:147
iterator insert_or_assign(const_iterator, key_arg< K > &&k, V &&v)
Definition: phmap.h:2384
std::pair< iterator, bool > insert_or_assign(key_arg< K > &&k, V &&v)
Definition: phmap.h:2363
typename raw_hash_map::raw_hash_set::const_iterator const_iterator
Definition: phmap.h:2349
decltype(P::value(std::addressof(std::declval< typename raw_hash_map::reference >()))) MappedReference
Definition: phmap.h:2324
std::pair< iterator, bool > insert_or_assign(key_arg< K > &&k, const V &v)
Definition: phmap.h:2368
std::pair< iterator, bool > try_emplace_impl(K &&k, Args &&... args)
Definition: phmap.h:2466
iterator insert_or_assign(const_iterator, key_arg< K > &&k, const V &v)
Definition: phmap.h:2389
MappedReference< P > operator[](key_arg< K > &&key)
Definition: phmap.h:2445
MappedReference< P > at(const key_arg< K > &key)
Definition: phmap.h:2429
MappedConstReference< P > at(const key_arg< K > &key) const
Definition: phmap.h:2437
iterator try_emplace(const_iterator, const key_arg< K > &k, Args &&... args)
Definition: phmap.h:2424
iterator insert_or_assign(const_iterator, const key_arg< K > &k, V &&v)
Definition: phmap.h:2394
MappedReference< P > operator[](const key_arg< K > &key)
Definition: phmap.h:2450
iterator insert_or_assign(const_iterator, const key_arg< K > &k, const V &v)
Definition: phmap.h:2399
std::pair< iterator, bool > insert_or_assign(const key_arg< K > &k, const V &v)
Definition: phmap.h:2378
std::pair< iterator, bool > try_emplace(const key_arg< K > &k, Args &&... args)
Definition: phmap.h:2414
std::pair< iterator, bool > insert_or_assign(const key_arg< K > &k, V &&v)
Definition: phmap.h:2373
typename Policy::mapped_type mapped_type
Definition: phmap.h:2338
decltype(P::value(std::addressof(std::declval< typename raw_hash_map::const_reference >()))) MappedConstReference
Definition: phmap.h:2329
std::pair< iterator, bool > try_emplace(key_arg< K > &&k, Args &&... args)
Definition: phmap.h:2407
typename KeyArgImpl::template type< K, key_type > key_arg
Definition: phmap.h:2340
std::pair< iterator, bool > insert_or_assign_impl(K &&k, V &&v)
Definition: phmap.h:2456
typename raw_hash_map::raw_hash_set::iterator iterator
Definition: phmap.h:2348
raw_hash_map()
Definition: phmap.h:2351
typename Policy::key_type key_type
Definition: phmap.h:2337
iterator try_emplace(const_iterator, key_arg< K > &&k, Args &&... args)
Definition: phmap.h:2419
const_iterator()
Definition: phmap.h:1021
friend bool operator!=(const const_iterator &a, const const_iterator &b)
Definition: phmap.h:1037
typename raw_hash_set::value_type value_type
Definition: phmap.h:1016
typename raw_hash_set::difference_type difference_type
Definition: phmap.h:1019
const_iterator & operator++()
Definition: phmap.h:1028
reference operator*() const
Definition: phmap.h:1025
typename iterator::iterator_category iterator_category
Definition: phmap.h:1015
friend bool operator==(const const_iterator &a, const const_iterator &b)
Definition: phmap.h:1034
pointer operator->() const
Definition: phmap.h:1026
typename raw_hash_set::const_reference reference
Definition: phmap.h:1017
typename raw_hash_set::const_pointer pointer
Definition: phmap.h:1018
const_iterator operator++(int)
Definition: phmap.h:1032
iterator inner_
Definition: phmap.h:1045
const_iterator(const ctrl_t *ctrl, const slot_type *slot)
Definition: phmap.h:1042
const_iterator(iterator i)
Definition: phmap.h:1023
constructor(allocator_type *a, slot_type **slot)
Definition: phmap.h:1517
allocator_type * alloc_
Definition: phmap.h:1519
void operator()(Args &&... args) const
Definition: phmap.h:1510
slot_type ** slot_
Definition: phmap.h:1520
reference operator*() const
Definition: phmap.h:941
typename raw_hash_set::value_type value_type
Definition: phmap.h:931
ctrl_t * ctrl_
Definition: phmap.h:1002
iterator(ctrl_t *ctrl, slot_type *slot)
Definition: phmap.h:988
iterator operator++(int)
Definition: phmap.h:954
phmap::conditional_t< PolicyTraits::constant_iterators::value, const value_type &, value_type & > reference
Definition: phmap.h:934
friend bool operator!=(const iterator &a, const iterator &b)
Definition: phmap.h:982
iterator & operator++()
Definition: phmap.h:947
iterator(ctrl_t *ctrl)
Definition: phmap.h:987
void skip_empty_or_deleted()
Definition: phmap.h:990
std::forward_iterator_tag iterator_category
Definition: phmap.h:930
typename raw_hash_set::difference_type difference_type
Definition: phmap.h:936
phmap::remove_reference_t< reference > * pointer
Definition: phmap.h:935
friend bool operator==(const iterator &a, const iterator &b)
Definition: phmap.h:979
slot_type * slot_
Definition: phmap.h:1006
pointer operator->() const
Definition: phmap.h:944
iterator()
Definition: phmap.h:938
void lazy_emplace_at(size_t &idx, F &&f)
Definition: phmap.h:1542
iterator iterator_at(size_t i)
Definition: phmap.h:2226
PHMAP_ATTRIBUTE_REINITIALIZES void clear()
Definition: phmap.h:1264
hash_policy_traits< Policy > PolicyTraits
Definition: phmap.h:840
raw_hash_set(std::initializer_list< T > init, const allocator_type &alloc)
Definition: phmap.h:1151
raw_hash_set(std::initializer_list< init_type > init, size_t bucket_cnt=0, const hasher &hashfn=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
Definition: phmap.h:1127
bool has_element(const value_type &elem, size_t hashval) const
Definition: phmap.h:2111
iterator find(const key_arg< K > &key)
Definition: phmap.h:1757
Hash hasher
Definition: phmap.h:853
size_t prepare_insert(size_t hashval) PHMAP_ATTRIBUTE_NOINLINE
Definition: phmap.h:2194
friend bool operator!=(const raw_hash_set &a, const raw_hash_set &b)
Definition: phmap.h:1818
std::pair< size_t, bool > find_or_prepare_insert(const K &key, size_t hashval)
Definition: phmap.h:2173
raw_hash_set & move_assign(raw_hash_set &&that, std::true_type)
Definition: phmap.h:2160
raw_hash_set(raw_hash_set &&that, const allocator_type &a)
Definition: phmap.h:1195
float max_load_factor() const
Definition: phmap.h:1798
raw_hash_set & move_assign(raw_hash_set &&that, std::false_type)
Definition: phmap.h:2165
FindInfo find_first_non_full(size_t hashval)
Definition: phmap.h:2146
bool phmap_load(InputArchive &)
Definition: phmap_dump.h:67
insert_return_type insert(node_type &&node)
Definition: phmap.h:1392
Alloc allocator_type
Definition: phmap.h:850
bool is_small() const
Definition: phmap.h:2289
void insert(InputIt first, InputIt last)
Definition: phmap.h:1371
size_t & growth_left()
Definition: phmap.h:2263
const_iterator cend() const
Definition: phmap.h:1257
typename phmap::allocator_traits< allocator_type >::template rebind_traits< value_type >::const_pointer const_pointer
Definition: phmap.h:862
void destroy_slots()
Definition: phmap.h:1991
raw_hash_set(std::initializer_list< T > init, size_t bucket_cnt, const allocator_type &alloc)
Definition: phmap.h:1142
const_iterator find(const key_arg< K > &key, size_t hashval) const
Definition: phmap.h:1762
key_equal key_eq() const
Definition: phmap.h:1804
raw_hash_set(std::initializer_list< init_type > init, const allocator_type &alloc)
Definition: phmap.h:1154
void reserve(size_t n)
Definition: phmap.h:1692
raw_hash_set(raw_hash_set &&that) noexcept(std::is_nothrow_copy_constructible< hasher >::value &&std::is_nothrow_copy_constructible< key_equal >::value &&std::is_nothrow_copy_constructible< allocator_type >::value)
Definition: phmap.h:1178
iterator end()
Definition: phmap.h:1243
iterator erase(iterator it)
Definition: phmap.h:1599
void emplace_single_with_hash(const key_arg< K > &key, size_t hashval, F &&f)
Definition: phmap.h:1549
phmap::priv::CompressedTuple< size_t, hasher, key_equal, allocator_type > settings_
Definition: phmap.h:2310
iterator lazy_emplace_with_hash(const key_arg< K > &key, size_t hashval, F &&f)
Definition: phmap.h:1533
typename PolicyTraits::value_type value_type
Definition: phmap.h:856
typename std::enable_if< phmap::disjunction< std::is_convertible< T, init_type >, SameAsElementReference< T > >::value, int >::type RequiresInsertable
Definition: phmap.h:908
const hasher & hash_ref() const
Definition: phmap.h:2292
raw_hash_set & operator=(raw_hash_set &&that) noexcept(phmap::allocator_traits< allocator_type >::is_always_equal::value &&std::is_nothrow_move_assignable< hasher >::value &&std::is_nothrow_move_assignable< key_equal >::value)
Definition: phmap.h:1225
void _erase(const_iterator cit)
Definition: phmap.h:1595
std::pair< iterator, bool > emplace_decomposable(const K &key, size_t hashval, Args &&... args)
Definition: phmap.h:1884
void reset_ctrl(size_t capacity)
Definition: phmap.h:2237
bool contains(const key_arg< K > &key, size_t hashval) const
Definition: phmap.h:1776
size_t max_size() const
Definition: phmap.h:1262
size_t count(const key_arg< K > &key) const
Definition: phmap.h:1704
size_t size_
Definition: phmap.h:2305
bool phmap_dump(OutputArchive &) const
Definition: phmap_dump.h:52
iterator find(const key_arg< K > &key, size_t hashval)
Definition: phmap.h:1739
raw_hash_set(const raw_hash_set &that, const allocator_type &a)
Definition: phmap.h:1162
value_type & reference
Definition: phmap.h:857
iterator insert(const_iterator, init_type &&value)
Definition: phmap.h:1347
void swap(raw_hash_set &that) noexcept(IsNoThrowSwappable< hasher >() &&IsNoThrowSwappable< key_equal >() &&(!AllocTraits::propagate_on_container_swap::value||IsNoThrowSwappable< allocator_type >()))
Definition: phmap.h:1647
typename PolicyTraits::key_type key_type
Definition: phmap.h:846
std::pair< iterator, bool > insert(const T &value)
Definition: phmap.h:1318
iterator insert(const_iterator, node_type &&node)
Definition: phmap.h:1420
typename PolicyTraits::slot_type slot_type
Definition: phmap.h:849
void drop_deletes_without_resize() PHMAP_ATTRIBUTE_NOINLINE
Definition: phmap.h:2036
raw_hash_set(std::initializer_list< init_type > init, size_t bucket_cnt, const hasher &hashfn, const allocator_type &alloc)
Definition: phmap.h:1137
node_type extract(const_iterator position)
Definition: phmap.h:1632
hasher & hash_ref()
Definition: phmap.h:2291
const value_type & const_reference
Definition: phmap.h:858
friend void swap(raw_hash_set &a, raw_hash_set &b) noexcept(noexcept(a.swap(b)))
Definition: phmap.h:1822
std::pair< const_iterator, const_iterator > equal_range(const key_arg< K > &key) const
Definition: phmap.h:1787
void reset_growth_left(size_t capacity)
Definition: phmap.h:2243
size_t size() const
Definition: phmap.h:1260
insert_return_type insert(node_type &&node, size_t hashval)
Definition: phmap.h:1406
size_t hash(const K &key) const
Definition: phmap.h:1828
void insert(std::initializer_list< init_type > ilist)
Definition: phmap.h:1388
void _erase(iterator it)
Definition: phmap.h:1590
pointer find_ptr(const key_arg< K > &key, size_t hashval)
Definition: phmap.h:1748
node_type extract(const key_arg< K > &key)
Definition: phmap.h:1642
bool has_element(const value_type &elem) const
Definition: phmap.h:2127
iterator lazy_emplace(const key_arg< K > &key, F &&f)
Definition: phmap.h:1524
void prefetch_hash(size_t hashval) const
Definition: phmap.h:1713
raw_hash_set(InputIter first, InputIter last, size_t bucket_cnt=0, const hasher &hashfn=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
Definition: phmap.h:1079
raw_hash_set() noexcept(std::is_nothrow_default_constructible< hasher >::value &&std::is_nothrow_default_constructible< key_equal >::value &&std::is_nothrow_default_constructible< allocator_type >::value)
Definition: phmap.h:1051
Eq key_equal
Definition: phmap.h:854
void max_load_factor(float)
Definition: phmap.h:1799
node_handle< Policy, hash_policy_traits< Policy >, Alloc > node_type
Definition: phmap.h:1048
void prefetch(const key_arg< K > &key) const
Definition: phmap.h:1727
void merge(raw_hash_set< Policy, H, E, Alloc > &&src)
Definition: phmap.h:1628
static Layout MakeLayout(size_t capacity)
Definition: phmap.h:878
iterator insert(const_iterator, const T &value)
Definition: phmap.h:1343
iterator begin()
Definition: phmap.h:1238
raw_hash_set(InputIter first, InputIter last, size_t bucket_cnt, const hasher &hashfn, const allocator_type &alloc)
Definition: phmap.h:1087
typename KeyArgImpl::template type< K, key_type > key_arg
Definition: phmap.h:869
void rehash_and_grow_if_necessary()
Definition: phmap.h:2099
allocator_type & alloc_ref()
Definition: phmap.h:2295
raw_hash_set(const allocator_type &alloc)
Definition: phmap.h:1075
slot_type * slots_
Definition: phmap.h:2304
IsDecomposable< void, PolicyTraits, Hash, Eq, Ts... > IsDecomposable
Definition: phmap.h:917
raw_hash_set(size_t bucket_cnt, const hasher &hashfn=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
Definition: phmap.h:1056
std::pair< size_t, bool > find_or_prepare_insert(const K &key)
Definition: phmap.h:2190
raw_hash_set(std::initializer_list< init_type > init, size_t bucket_cnt, const allocator_type &alloc)
Definition: phmap.h:1146
iterator emplace_hint(const_iterator, Args &&... args)
Definition: phmap.h:1473
float load_factor() const
Definition: phmap.h:1795
auto KeyTypeCanBeEq(const Eq &eq, const key_type &k) -> decltype(eq(k, k))
iterator insert(const_iterator, T &&value)
Definition: phmap.h:1334
ptrdiff_t difference_type
Definition: phmap.h:852
typename phmap::allocator_traits< allocator_type >::template rebind_traits< slot_type > SlotAllocTraits
Definition: phmap.h:887
~raw_hash_set()
Definition: phmap.h:1236
hasher hash_function() const
Definition: phmap.h:1803
raw_hash_set & operator=(const raw_hash_set &that)
Definition: phmap.h:1216
bool find_impl(const key_arg< K > &key, size_t hashval, size_t &offset)
Definition: phmap.h:1837
iterator emplace_hint_with_hash(size_t hashval, const_iterator, Args &&... args)
Definition: phmap.h:1478
std::pair< iterator, bool > insert(init_type &&value)
Definition: phmap.h:1327
friend struct RawHashSetTestOnlyAccess
Definition: phmap.h:2230
HashtablezInfoHandle infoz_
Definition: phmap.h:2307
probe_seq< Group::kWidth > probe(size_t hashval) const
Definition: phmap.h:2232
phmap::priv::Layout< ctrl_t, slot_type > Layout
Definition: phmap.h:876
std::is_same< typename std::iterator_traits< It >::iterator_category, std::random_access_iterator_tag > IsRandomAccess
Definition: phmap.h:1353
bool contains(const key_arg< K > &key) const
Definition: phmap.h:1771
void insert(std::initializer_list< T > ilist)
Definition: phmap.h:1384
friend bool operator==(const raw_hash_set &a, const raw_hash_set &b)
Definition: phmap.h:1807
size_t bucket_count() const
Definition: phmap.h:1794
std::pair< iterator, iterator > equal_range(const key_arg< K > &key)
Definition: phmap.h:1781
raw_hash_set(size_t bucket_cnt, const hasher &hashfn, const allocator_type &alloc)
Definition: phmap.h:1068
raw_hash_set(const raw_hash_set &that)
Definition: phmap.h:1158
raw_hash_set(InputIter first, InputIter last, const allocator_type &alloc)
Definition: phmap.h:1097
std::pair< iterator, bool > insert(T &&value)
Definition: phmap.h:1298
ctrl_t * ctrl_
Definition: phmap.h:2303
const_iterator end() const
Definition: phmap.h:1255
typename phmap::allocator_traits< allocator_type >::template rebind_traits< value_type >::pointer pointer
Definition: phmap.h:860
void erase_meta_only(const_iterator it)
Definition: phmap.h:1953
raw_hash_set(size_t bucket_cnt, const allocator_type &alloc)
Definition: phmap.h:1072
const_iterator cbegin() const
Definition: phmap.h:1256
size_t capacity_
Definition: phmap.h:2306
std::pair< iterator, bool > emplace(Args &&... args)
Definition: phmap.h:1437
const key_equal & eq_ref() const
Definition: phmap.h:2294
Policy policy_type
Definition: phmap.h:855
iterator erase(const_iterator cit)
Definition: phmap.h:1576
typename std::enable_if<!std::is_same< T, init_type >::value, int >::type RequiresNotInit
Definition: phmap.h:914
auto KeyTypeCanBeHashed(const Hash &h, const key_type &k) -> decltype(h(k))
void set_ctrl(size_t i, ctrl_t h)
Definition: phmap.h:2249
size_type erase(const key_arg< K > &key)
Definition: phmap.h:1568
const_iterator find(const key_arg< K > &key) const
Definition: phmap.h:1766
raw_hash_set(std::initializer_list< T > init, size_t bucket_cnt, const hasher &hashfn, const allocator_type &alloc)
Definition: phmap.h:1133
void rehash(size_t n)
Definition: phmap.h:1676
const_iterator iterator_at(size_t i) const
Definition: phmap.h:2227
void merge(raw_hash_set< Policy, H, E, Alloc > &src)
Definition: phmap.h:1616
raw_hash_set(std::initializer_list< T > init, size_t bucket_cnt=0, const hasher &hashfn=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
Definition: phmap.h:1122
const allocator_type & alloc_ref() const
Definition: phmap.h:2296
void emplace_at(size_t i, Args &&... args)
Definition: phmap.h:2217
const_iterator begin() const
Definition: phmap.h:1252
void initialize_slots(size_t new_capacity)
Definition: phmap.h:1974
bool empty() const
Definition: phmap.h:1259
allocator_type get_allocator() const
Definition: phmap.h:1805
size_t size_type
Definition: phmap.h:851
typename phmap::allocator_traits< allocator_type >::template rebind_alloc< slot_type > SlotAlloc
Definition: phmap.h:885
iterator erase(const_iterator first, const_iterator last)
Definition: phmap.h:1606
typename PolicyTraits::init_type init_type
Definition: phmap.h:845
void resize(size_t new_capacity)
Definition: phmap.h:2009
key_equal & eq_ref()
Definition: phmap.h:2293
size_t capacity() const
Definition: phmap.h:1261
std::pair< iterator, bool > emplace_with_hash(size_t hashval, Args &&... args)
Definition: phmap.h:1443
raw_hash_set(InputIter first, InputIter last, size_t bucket_cnt, const allocator_type &alloc)
Definition: phmap.h:1092
_string<> string
Definition: ne_stl_string.h:762
PHMAP_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64(uint64_t n)
Definition: phmap_bits.h:282
PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountTrailingZerosNonZero64(uint64_t n)
Definition: phmap_bits.h:363
PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountTrailingZerosNonZero32(uint32_t n)
Definition: phmap_bits.h:396
PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros32(uint32_t n)
Definition: phmap_bits.h:326
static void ThrowStdOutOfRange(const std::string &what_arg)
Definition: phmap_base.h:694
void Store64(void *p, uint64_t v)
Definition: phmap_bits.h:592
auto GetKey(const typename T::value_type &pair, int) -> decltype(get< 0 >(pair))
Definition: phmap.h:609
auto TupleRef(T &&t) -> decltype(TupleRefImpl(std::forward< T >(t), phmap::make_index_sequence< std::tuple_size< typename std::decay< T >::type >::value >()))
Definition: phmap.h:736
decltype(std::declval< F >()(std::declval< T >())) WithConstructedImpl(Tuple &&t, phmap::index_sequence< Is... >, F &&f)
Definition: phmap.h:720
decltype(std::declval< F >()(std::declval< const K & >(), std::piecewise_construct, std::declval< std::tuple< K > >(), std::declval< V >())) DecomposePairImpl(F &&f, std::pair< std::tuple< K >, V > p)
Definition: phmap.h:749
void ConstructFromTupleImpl(Alloc *alloc, T *ptr, Tuple &&t, phmap::index_sequence< I... >)
Definition: phmap.h:703
auto TupleRefImpl(T &&t, phmap::index_sequence< Is... >) -> decltype(std::forward_as_tuple(std::get< Is >(std::forward< T >(t))...))
Definition: phmap.h:727
size_t HashSeed(const ctrl_t *ctrl)
Definition: phmap.h:330
decltype(std::declval< F >()(std::declval< T >())) WithConstructed(Tuple &&t, F &&f)
Definition: phmap.h:4064
static void SetHashtablezSampleParameter(int32_t)
Definition: phmap.h:693
size_t CapacityToGrowth(size_t capacity)
Definition: phmap.h:573
ctrl_t * EmptyGroup()
Definition: phmap.h:322
bool IsValidCapacity(size_t n)
Definition: phmap.h:536
constexpr bool IsNoThrowSwappable()
Definition: phmap.h:195
void SwapAlloc(AllocType &lhs, AllocType &rhs, std::true_type)
Definition: phmap.h:133
std::pair< std::tuple<>, std::tuple<> > PairArgs()
Definition: phmap.h:4086
static HashtablezInfo * SampleSlow(int64_t *)
Definition: phmap.h:663
decltype(std::declval< F >()(std::declval< const Arg & >(), std::declval< Arg >())) DecomposeValue(F &&f, Arg &&arg)
Definition: phmap.h:4127
static void RecordInsertSlow(HashtablezInfo *, size_t, size_t)
Definition: phmap.h:659
constexpr size_t NumClonedBytes()
Definition: phmap.h:531
static void RecordEraseSlow(HashtablezInfo *)
Definition: phmap.h:661
std::size_t erase_if(C &c, Pred pred)
Definition: phmap.h:5051
int LeadingZeros(T x)
Definition: phmap.h:211
void SanitizerPoisonObject(const T *object)
Definition: phmap_base.h:4407
static void UnsampleSlow(HashtablezInfo *)
Definition: phmap.h:664
uint8_t h2_t
Definition: phmap.h:285
typename phmap::Allocator< T > Allocator
Definition: phmap_fwd_decl.h:61
Ctrl
Definition: phmap.h:292
@ kDeleted
Definition: phmap.h:294
@ kSentinel
Definition: phmap.h:295
@ kEmpty
Definition: phmap.h:293
bool IsDeleted(ctrl_t c)
Definition: phmap.h:358
size_t NormalizeCapacity(size_t n)
Definition: phmap.h:564
auto DecomposePair(F &&f, Args &&... args) -> decltype(memory_internal::DecomposePairImpl(std::forward< F >(f), PairArgs(std::forward< Args >(args)...)))
Definition: phmap.h:4116
void RecordRehashSlow(HashtablezInfo *, size_t)
Definition: phmap.h:657
h2_t H2(size_t hashval)
Definition: phmap.h:354
void ConvertDeletedToEmptyAndFullToDeleted(ctrl_t *ctrl, size_t capacity)
Definition: phmap.h:548
int TrailingZeros(T x)
Definition: phmap.h:202
void SanitizerUnpoisonObject(const T *object)
Definition: phmap_base.h:4412
GroupPortableImpl Group
Definition: phmap.h:525
void ConstructFromTuple(Alloc *alloc, T *ptr, Tuple &&t)
Definition: phmap.h:4053
static void SetHashtablezMaxSamples(int32_t)
Definition: phmap.h:694
void SanitizerPoisonMemoryRegion(const void *m, size_t s)
Definition: phmap_base.h:4384
void SanitizerUnpoisonMemoryRegion(const void *m, size_t s)
Definition: phmap_base.h:4395
bool IsEmpty(ctrl_t c)
Definition: phmap.h:356
size_t GrowthToLowerboundCapacity(size_t growth)
Definition: phmap.h:591
static HashtablezInfoHandle Sample()
Definition: phmap.h:677
static void SetHashtablezEnabled(bool)
Definition: phmap.h:692
signed char ctrl_t
Definition: phmap.h:284
bool IsEmptyOrDeleted(ctrl_t c)
Definition: phmap.h:359
size_t H1(size_t hashval, const ctrl_t *)
Definition: phmap.h:347
bool IsFull(ctrl_t c)
Definition: phmap.h:357
size_t RandomSeed()
Definition: phmap.h:2479
typename std::conditional< B, T, F >::type conditional_t
Definition: phmap_base.h:322
T exchange(T &obj, U &&new_value)
Definition: phmap_base.h:1127
void erase_if(btree_set< K, C, A > &set, Pred pred)
Definition: btree.h:3889
typename std::remove_reference< T >::type remove_reference_t
Definition: phmap_base.h:285
constexpr phmap::remove_reference_t< T > && move(T &&t) noexcept
Definition: phmap_base.h:1029
make_integer_sequence< size_t, N > make_index_sequence
Definition: phmap_base.h:966
typename type_traits_internal::VoidTImpl< Ts... >::type void_t
Definition: btree.h:134
#define PHMAP_PREDICT_TRUE(x)
Definition: phmap_bits.h:252
#define PHMAP_PREDICT_FALSE(x)
Definition: phmap_bits.h:251
#define PHMAP_ATTRIBUTE_NOINLINE
Definition: phmap_config.h:434
#define PHMAP_ATTRIBUTE_REINITIALIZES
Definition: phmap_config.h:604
#define PHMAP_IF_CONSTEXPR(expr)
Definition: phmap_config.h:672
unsigned char bool
Definition: stdbool.h:25
Definition: phmap_utils.h:139
Definition: phmap_base.h:4785
Definition: phmap_base.h:1379
static void construct(Alloc &a, T *p, Args &&... args)
Definition: phmap_base.h:1491
memory_internal::ExtractOrT< memory_internal::GetPropagateOnContainerMoveAssignment, Alloc, std::false_type > propagate_on_container_move_assignment
Definition: phmap_base.h:1439
static void destroy(Alloc &a, T *p)
Definition: phmap_base.h:1499
static void deallocate(Alloc &a, pointer p, size_type n)
Definition: phmap_base.h:1481
static pointer allocate(Alloc &a, size_type n)
Definition: phmap_base.h:1466
Definition: phmap_base.h:224
Definition: phmap_base.h:906
Definition: phmap_utils.h:54
static void Reset(Node *node)
Definition: phmap_base.h:2895
static auto GetSlot(const Node &node) -> decltype(node.slot())
Definition: phmap_base.h:2885
static size_t space_used(const slot_type *)
Definition: phmap.h:4226
K key_type
Definition: phmap.h:4198
typename slot_policy::slot_type slot_type
Definition: phmap.h:4197
static void destroy(Allocator *alloc, slot_type *slot)
Definition: phmap.h:4208
static decltype(phmap::priv::DecomposePair(std::declval< F >(), std::declval< Args >()...)) apply(F &&f, Args &&... args)
Definition: phmap.h:4221
static const V & value(const std::pair< const K, V > *kv)
Definition: phmap.h:4231
std::pair< key_type, mapped_type > init_type
Definition: phmap.h:4200
static std::pair< const K, V > & element(slot_type *slot)
Definition: phmap.h:4228
static void transfer(Allocator *alloc, slot_type *new_slot, slot_type *old_slot)
Definition: phmap.h:4213
static void construct(Allocator *alloc, slot_type *slot, Args &&... args)
Definition: phmap.h:4203
static V & value(std::pair< const K, V > *kv)
Definition: phmap.h:4230
V mapped_type
Definition: phmap.h:4199
T key_type
Definition: phmap.h:4156
static void transfer(Allocator *alloc, slot_type *new_slot, slot_type *old_slot)
Definition: phmap.h:4172
static T & element(slot_type *slot)
Definition: phmap.h:4178
static size_t space_used(const T *)
Definition: phmap.h:4188
T init_type
Definition: phmap.h:4157
static void destroy(Allocator *alloc, slot_type *slot)
Definition: phmap.h:4167
static decltype(phmap::priv::DecomposeValue(std::declval< F >(), std::declval< Args >()...)) apply(F &&f, Args &&... args)
Definition: phmap.h:4183
static void construct(Allocator *alloc, slot_type *slot, Args &&... args)
Definition: phmap.h:4161
std::true_type constant_iterators
Definition: phmap.h:4158
T slot_type
Definition: phmap.h:4155
BitMask< uint64_t, kWidth, 3 > Match(h2_t hash) const
Definition: phmap.h:476
BitMask< uint64_t, kWidth, 3 > MatchEmpty() const
Definition: phmap.h:496
void ConvertSpecialToEmptyAndFullToDeleted(ctrl_t *dst) const
Definition: phmap.h:511
BitMask< uint64_t, kWidth, 3 > MatchEmptyOrDeleted() const
Definition: phmap.h:501
GroupPortableImpl(const ctrl_t *pos)
Definition: phmap.h:473
@ kWidth
Definition: phmap.h:471
uint64_t ctrl
Definition: phmap.h:519
uint32_t CountLeadingEmptyOrDeleted() const
Definition: phmap.h:506
bool operator()(const A &a, const B &b) const
Definition: phmap.h:4436
void is_transparent
Definition: phmap.h:4434
void is_transparent
Definition: phmap.h:4426
size_t operator()(const U &ptr) const
Definition: phmap.h:4428
static const T * ToPtr(const T *ptr)
Definition: phmap.h:4442
static const T * ToPtr(const std::unique_ptr< U, D > &ptr)
Definition: phmap.h:4445
static const T * ToPtr(const std::shared_ptr< U > &ptr)
Definition: phmap.h:4450
Definition: phmap_fwd_decl.h:48
void PrepareForSampling()
Definition: phmap.h:654
Definition: phmap_base.h:2918
Definition: phmap_base.h:2716
Definition: phmap_base.h:2723
static T * new_element(Allocator *alloc, Args &&... args)
Definition: phmap.h:4285
static size_t element_space_used(const T *)
Definition: phmap.h:4312
T init_type
Definition: phmap.h:4281
T key_type
Definition: phmap.h:4280
std::true_type constant_iterators
Definition: phmap.h:4282
static decltype(phmap::priv::DecomposeValue(std::declval< F >(), std::declval< Args >()...)) apply(F &&f, Args &&... args)
Definition: phmap.h:4307
static void delete_element(Allocator *alloc, T *elem)
Definition: phmap.h:4296
std::pair< decltype(std::declval< const Hash & >()(std::declval< const PassedKey & >())), decltype(std::declval< const Eq & >()(std::declval< const ContainerKey & >(), std::declval< const PassedKey & >()))> * operator()(const PassedKey &, const Args &...) const
Definition: phmap_base.h:425
typename std::remove_reference< reference >::type value_type
Definition: phmap_base.h:460
static auto key(slot_type *slot) -> decltype(P::apply(ReturnKey(), element(slot)))
Definition: phmap_base.h:554
static void transfer(Alloc *alloc, slot_type *new_slot, slot_type *old_slot)
Definition: phmap_base.h:494
static auto element(slot_type *slot) -> decltype(P::element(slot))
Definition: phmap_base.h:501
typename Policy::init_type init_type
Definition: phmap_base.h:456
static void construct(Alloc *alloc, slot_type *slot, Args &&... args)
Definition: phmap_base.h:471
static auto apply(F &&f, Ts &&... ts) -> decltype(P::apply(std::forward< F >(f), std::forward< Ts >(ts)...))
Definition: phmap_base.h:546
static void destroy(Alloc *alloc, slot_type *slot)
Definition: phmap_base.h:478
typename Policy::slot_type slot_type
Definition: phmap_base.h:448
typename Policy::key_type key_type
Definition: phmap_base.h:451
static auto value(T *elem) -> decltype(P::value(elem))
Definition: phmap_base.h:562
typename Set::PolicyTraits Traits
Definition: phmap.h:4542
static size_t GetNumProbes(const Set &set, const typename Set::key_type &key)
Definition: phmap.h:4546
typename Traits::slot_type Slot
Definition: phmap.h:4543
typename Set::EmbeddedSet EmbeddedSet
Definition: phmap.h:4544
static size_t LowerBoundAllocatedByteSize(size_t size)
Definition: phmap.h:4519
static size_t GetNumProbes(const Set &set, const typename Set::key_type &key)
Definition: phmap.h:4479
typename Traits::slot_type Slot
Definition: phmap.h:4477
static size_t AllocatedByteSize(const Set &c)
Definition: phmap.h:4500
typename Set::PolicyTraits Traits
Definition: phmap.h:4476
static size_t GetNumProbes(const Container &c, const typename Container::key_type &key)
Definition: phmap.h:635
Definition: phmap_base.h:4634
static void destroy(Allocator *alloc, slot_type *slot)
Definition: phmap_base.h:4686
static void transfer(Allocator *alloc, slot_type *new_slot, slot_type *old_slot)
Definition: phmap_base.h:4695
static void construct(Allocator *alloc, slot_type *slot, Args &&... args)
Definition: phmap_base.h:4661
map_slot_type< K, V > slot_type
Definition: phmap_base.h:4635
decltype(std::declval< F >()(std::declval< T >())) operator()(Args &&... args) const
Definition: phmap.h:712
F && f
Definition: phmap.h:716
static auto value(T *elem) -> decltype(P::value(elem))
Definition: phmap.h:4264
static void transfer(Alloc *, slot_type *new_slot, slot_type *old_slot)
Definition: phmap.h:4252
static size_t space_used(const slot_type *slot)
Definition: phmap.h:4256
static Reference element(slot_type *slot)
Definition: phmap.h:4261
static auto apply(Ts &&... ts) -> decltype(P::apply(std::forward< Ts >(ts)...))
Definition: phmap.h:4269
static void destroy(Alloc *alloc, slot_type *slot)
Definition: phmap.h:4247
typename std::remove_cv< typename std::remove_reference< Reference >::type >::type * slot_type
Definition: phmap.h:4239
static void construct(Alloc *alloc, slot_type *slot, Args &&... args)
Definition: phmap.h:4242
std::pair< iterator, bool > operator()(const K &key, Args &&... args) const
Definition: phmap.h:3056
parallel_hash_set & s
Definition: phmap.h:3059
size_t hashval
Definition: phmap.h:3060
parallel_hash_set & s
Definition: phmap.h:3133
std::pair< iterator, bool > operator()(const K &key, Args &&... args) const
Definition: phmap.h:3130
bool operator()(const K2 &lhs, Args &&...) const
Definition: phmap.h:3680
const K1 & rhs
Definition: phmap.h:3683
const key_equal & eq
Definition: phmap.h:3684
const_iterator operator()(const K &key, Args &&...) const
Definition: phmap.h:3661
const parallel_hash_set & s
Definition: phmap.h:3664
const hasher & h
Definition: phmap.h:3673
size_t operator()(const K &key, Args &&...) const
Definition: phmap.h:3670
const key_equal & eq
Definition: phmap.h:2547
const hasher & hashfn
Definition: phmap.h:2546
const allocator_type & alloc
Definition: phmap.h:2548
size_t bucket_cnt
Definition: phmap.h:2545
EmbeddedSet set_
Definition: phmap.h:2562
bool operator==(const Inner &o) const
Definition: phmap.h:2556
Inner()
Definition: phmap.h:2551
Inner(Params const &p)
Definition: phmap.h:2553
Key operator()(Key &&k, const Args &...) const
Definition: phmap.h:3034
size_t hashval
Definition: phmap.h:1909
raw_hash_set & s
Definition: phmap.h:1908
std::pair< iterator, bool > operator()(const K &key, Args &&... args) const
Definition: phmap.h:1905
std::pair< iterator, bool > operator()(const K &key, Args &&... args) const
Definition: phmap.h:1897
raw_hash_set & s
Definition: phmap.h:1900
const K1 & rhs
Definition: phmap.h:1879
bool operator()(const K2 &lhs, Args &&...) const
Definition: phmap.h:1876
const key_equal & eq
Definition: phmap.h:1880
const raw_hash_set & s
Definition: phmap.h:1860
const_iterator operator()(const K &key, Args &&...) const
Definition: phmap.h:1857
size_t offset
Definition: phmap.h:2143
size_t probe_length
Definition: phmap.h:2144
size_t operator()(const K &key, Args &&...) const
Definition: phmap.h:1866
const hasher & h
Definition: phmap.h:1869
std::pair< iterator, bool > operator()(const K &key, Args &&...) &&
Definition: phmap.h:1916
raw_hash_set & s
Definition: phmap.h:1925
slot_type && slot
Definition: phmap.h:1927
size_t & hashval
Definition: phmap.h:1946
std::pair< iterator, bool > operator()(const K &key, Args &&...) &&
Definition: phmap.h:1934
slot_type && slot
Definition: phmap.h:1945
raw_hash_set & s
Definition: phmap.h:1943
std::true_type yes
Definition: phmap.h:1360
std::false_type no
Definition: phmap.h:1361
static auto test(int) -> decltype(std::declval< U >() - std::declval< U >()==1, yes())
static constexpr bool value
Definition: phmap.h:1367