11 #ifndef EASTL_FIXED_HASH_SET_H
12 #define EASTL_FIXED_HASH_SET_H
15 #include <EASTL/hash_set.h>
16 #include <EASTL/internal/fixed_pool.h>
18 EA_DISABLE_VC_WARNING(4127)
20 #if defined(EA_PRAGMA_ONCE_SUPPORTED)
34 #ifndef EASTL_FIXED_HASH_SET_DEFAULT_NAME
35 #define EASTL_FIXED_HASH_SET_DEFAULT_NAME EASTL_DEFAULT_NAME_PREFIX " fixed_hash_set"
38 #ifndef EASTL_FIXED_HASH_MULTISET_DEFAULT_NAME
39 #define EASTL_FIXED_HASH_MULTISET_DEFAULT_NAME EASTL_DEFAULT_NAME_PREFIX " fixed_hash_multiset"
46 #ifndef EASTL_FIXED_HASH_SET_DEFAULT_ALLOCATOR
47 #define EASTL_FIXED_HASH_SET_DEFAULT_ALLOCATOR overflow_allocator_type(EASTL_FIXED_HASH_SET_DEFAULT_NAME)
50 #ifndef EASTL_FIXED_HASH_MULTISET_DEFAULT_ALLOCATOR
51 #define EASTL_FIXED_HASH_MULTISET_DEFAULT_ALLOCATOR overflow_allocator_type(EASTL_FIXED_HASH_MULTISET_DEFAULT_NAME)
69 template <
typename Value,
size_t nodeCount,
size_t bucketCount = nodeCount + 1,
bool bEnableOverflow =
true,
71 class fixed_hash_set :
public hash_set<Value,
74 fixed_hashtable_allocator<
76 sizeof(typename hash_set<Value, Hash, Predicate, OverflowAllocator, bCacheHashCode>::node_type),
78 EASTL_ALIGN_OF(typename hash_set<Value, Hash, Predicate, OverflowAllocator, bCacheHashCode>::node_type),
85 typedef fixed_hashtable_allocator<bucketCount + 1,
sizeof(
typename hash_set<Value, Hash, Predicate,
86 OverflowAllocator, bCacheHashCode>::node_type), nodeCount,
87 EASTL_ALIGN_OF(
typename hash_set<Value, Hash, Predicate, OverflowAllocator, bCacheHashCode>::node_type),
88 0, bEnableOverflow, OverflowAllocator> fixed_allocator_type;
89 typedef typename fixed_allocator_type::overflow_allocator_type overflow_allocator_type;
90 typedef fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator> this_type;
91 typedef hash_set<Value, Hash, Predicate, fixed_allocator_type, bCacheHashCode> base_type;
92 typedef typename base_type::value_type value_type;
93 typedef typename base_type::node_type node_type;
94 typedef typename base_type::size_type size_type;
96 enum { kMaxSize = nodeCount };
98 using base_type::mAllocator;
101 node_type** mBucketBuffer[bucketCount + 1];
102 char mNodeBuffer[fixed_allocator_type::kBufferSize];
105 explicit fixed_hash_set(
const overflow_allocator_type& overflowAllocator);
107 explicit fixed_hash_set(
const Hash& hashFunction = Hash(),
108 const Predicate& predicate = Predicate());
110 fixed_hash_set(
const Hash& hashFunction,
111 const Predicate& predicate,
112 const overflow_allocator_type& overflowAllocator);
114 template <
typename InputIterator>
115 fixed_hash_set(InputIterator first, InputIterator last,
116 const Hash& hashFunction = Hash(),
117 const Predicate& predicate = Predicate());
119 fixed_hash_set(
const this_type& x);
120 fixed_hash_set(this_type&& x);
121 fixed_hash_set(this_type&& x,
const overflow_allocator_type& overflowAllocator);
125 this_type& operator=(
const this_type& x);
127 this_type& operator=(this_type&& x);
129 void swap(this_type& x);
131 void reset_lose_memory();
133 size_type max_size()
const;
135 const overflow_allocator_type& get_overflow_allocator() const EA_NOEXCEPT;
136 overflow_allocator_type& get_overflow_allocator() EA_NOEXCEPT;
137 void set_overflow_allocator(const overflow_allocator_type& allocator);
157 template <typename Value,
size_t nodeCount,
size_t bucketCount = nodeCount + 1,
bool bEnableOverflow = true,
158 typename Hash =
eastl::hash<Value>, typename Predicate =
eastl::equal_to<Value>,
bool bCacheHashCode = false, typename OverflowAllocator = EASTLAllocatorType>
159 class fixed_hash_multiset : public hash_multiset<Value,
162 fixed_hashtable_allocator<
164 sizeof(typename hash_multiset<Value, Hash, Predicate, OverflowAllocator, bCacheHashCode>::node_type),
166 EASTL_ALIGN_OF(typename hash_multiset<Value, Hash, Predicate, OverflowAllocator, bCacheHashCode>::node_type),
173 typedef fixed_hashtable_allocator<bucketCount + 1,
sizeof(
typename hash_multiset<Value, Hash, Predicate,
174 OverflowAllocator, bCacheHashCode>::node_type), nodeCount, EASTL_ALIGN_OF(
typename hash_multiset<Value, Hash, Predicate,
175 OverflowAllocator, bCacheHashCode>::node_type), 0,
176 bEnableOverflow, OverflowAllocator> fixed_allocator_type;
177 typedef typename fixed_allocator_type::overflow_allocator_type overflow_allocator_type;
178 typedef hash_multiset<Value, Hash, Predicate, fixed_allocator_type, bCacheHashCode> base_type;
179 typedef fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator> this_type;
180 typedef typename base_type::value_type value_type;
181 typedef typename base_type::node_type node_type;
182 typedef typename base_type::size_type size_type;
184 enum { kMaxSize = nodeCount };
186 using base_type::mAllocator;
189 node_type** mBucketBuffer[bucketCount + 1];
190 char mNodeBuffer[fixed_allocator_type::kBufferSize];
193 explicit fixed_hash_multiset(
const overflow_allocator_type& overflowAllocator);
195 explicit fixed_hash_multiset(
const Hash& hashFunction = Hash(),
196 const Predicate& predicate = Predicate());
198 fixed_hash_multiset(
const Hash& hashFunction,
199 const Predicate& predicate,
200 const overflow_allocator_type& overflowAllocator);
202 template <
typename InputIterator>
203 fixed_hash_multiset(InputIterator first, InputIterator last,
204 const Hash& hashFunction = Hash(),
205 const Predicate& predicate = Predicate());
207 fixed_hash_multiset(
const this_type& x);
208 fixed_hash_multiset(this_type&& x);
209 fixed_hash_multiset(this_type&& x,
const overflow_allocator_type& overflowAllocator);
212 this_type& operator=(
const this_type& x);
214 this_type& operator=(this_type&& x);
216 void swap(this_type& x);
218 void reset_lose_memory();
220 size_type max_size()
const;
222 const overflow_allocator_type& get_overflow_allocator() const EA_NOEXCEPT;
223 overflow_allocator_type& get_overflow_allocator() EA_NOEXCEPT;
224 void set_overflow_allocator(const overflow_allocator_type& allocator);
235 template <typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow, typename Hash, typename Predicate,
bool bCacheHashCode, typename OverflowAllocator>
236 inline fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
237 fixed_hash_set(const overflow_allocator_type& overflowAllocator)
238 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount),
239 Hash(), Predicate(), fixed_allocator_type(NULL, mBucketBuffer, overflowAllocator))
241 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
243 if (!bEnableOverflow)
245 base_type::set_max_load_factor(10000.f);
248 #if EASTL_NAME_ENABLED
249 mAllocator.set_name(EASTL_FIXED_HASH_SET_DEFAULT_NAME);
252 mAllocator.reset(mNodeBuffer);
256 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
257 inline fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
258 fixed_hash_set(
const Hash& hashFunction,
259 const Predicate& predicate)
260 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount),
261 hashFunction, predicate, fixed_allocator_type(NULL, mBucketBuffer))
263 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
266 base_type::set_max_load_factor(10000.f);
268 #if EASTL_NAME_ENABLED
269 mAllocator.set_name(EASTL_FIXED_HASH_SET_DEFAULT_NAME);
272 mAllocator.reset(mNodeBuffer);
276 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
277 inline fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
278 fixed_hash_set(
const Hash& hashFunction,
279 const Predicate& predicate,
280 const overflow_allocator_type& overflowAllocator)
281 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount),
282 hashFunction, predicate, fixed_allocator_type(NULL, mBucketBuffer, overflowAllocator))
284 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
286 if (!bEnableOverflow)
288 base_type::set_max_load_factor(10000.f);
291 #if EASTL_NAME_ENABLED
292 mAllocator.set_name(EASTL_FIXED_HASH_SET_DEFAULT_NAME);
295 mAllocator.reset(mNodeBuffer);
299 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
300 template <
typename InputIterator>
301 fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
302 fixed_hash_set(InputIterator first, InputIterator last,
303 const Hash& hashFunction,
304 const Predicate& predicate)
305 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), hashFunction,
306 predicate, fixed_allocator_type(NULL, mBucketBuffer))
308 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
312 base_type::set_max_load_factor(10000.f);
315 #if EASTL_NAME_ENABLED
316 mAllocator.set_name(EASTL_FIXED_HASH_SET_DEFAULT_NAME);
319 mAllocator.reset(mNodeBuffer);
320 base_type::insert(first, last);
324 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
325 inline fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
326 fixed_hash_set(
const this_type& x)
327 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), x.hash_function(),
328 x.equal_function(), fixed_allocator_type(NULL, mBucketBuffer))
330 mAllocator.copy_overflow_allocator(x.mAllocator);
332 #if EASTL_NAME_ENABLED
333 mAllocator.set_name(x.mAllocator.get_name());
336 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
339 base_type::set_max_load_factor(10000.f);
341 mAllocator.reset(mNodeBuffer);
342 base_type::insert(x.begin(), x.end());
346 template <
typename Key,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
347 inline fixed_hash_set<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::fixed_hash_set(this_type&& x)
348 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), x.hash_function(),
349 x.equal_function(), fixed_allocator_type(NULL, mBucketBuffer))
352 mAllocator.copy_overflow_allocator(x.mAllocator);
354 #if EASTL_NAME_ENABLED
355 mAllocator.set_name(x.mAllocator.get_name());
358 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
361 base_type::set_max_load_factor(10000.f);
363 mAllocator.reset(mNodeBuffer);
364 base_type::insert(x.begin(), x.end());
368 template <
typename Key,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
369 inline fixed_hash_set<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::fixed_hash_set(this_type&& x,
const overflow_allocator_type& overflowAllocator)
370 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount),
371 x.hash_function(), x.equal_function(), fixed_allocator_type(NULL, mBucketBuffer, overflowAllocator))
374 mAllocator.copy_overflow_allocator(x.mAllocator);
376 #if EASTL_NAME_ENABLED
377 mAllocator.set_name(x.mAllocator.get_name());
380 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
383 base_type::set_max_load_factor(10000.f);
385 mAllocator.reset(mNodeBuffer);
386 base_type::insert(x.begin(), x.end());
390 template <
typename Key,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
391 inline fixed_hash_set<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
393 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), Hash(),
394 Predicate(), fixed_allocator_type(NULL, mBucketBuffer, overflowAllocator))
396 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
399 base_type::set_max_load_factor(10000.f);
401 #if EASTL_NAME_ENABLED
402 mAllocator.set_name(EASTL_FIXED_HASH_SET_DEFAULT_NAME);
405 mAllocator.reset(mNodeBuffer);
406 base_type::insert(ilist.begin(), ilist.end());
410 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
411 typename fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::this_type&
412 fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::operator=(
const this_type& x)
414 base_type::operator=(x);
419 template <
typename Key,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
420 inline typename fixed_hash_set<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::this_type&
421 fixed_hash_set<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::operator=(this_type&& x)
428 template <
typename Key,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
429 inline typename fixed_hash_set<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::this_type&
430 fixed_hash_set<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::operator=(
std::initializer_list<value_type> ilist)
433 base_type::insert(ilist.begin(), ilist.end());
438 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
439 inline void fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
448 EASTL_ASSERT(
sizeof(x) < EASTL_MAX_STACK_USAGE);
450 const this_type temp(*
this);
456 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
457 void fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
460 base_type::reset_lose_memory();
461 base_type::get_allocator().reset(mNodeBuffer);
465 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
466 inline typename fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::size_type
467 fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::max_size()
const
473 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
474 inline const typename fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::overflow_allocator_type&
475 fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::get_overflow_allocator() const EA_NOEXCEPT
477 return mAllocator.get_overflow_allocator();
481 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
482 inline typename fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::overflow_allocator_type&
483 fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::get_overflow_allocator() EA_NOEXCEPT
485 return mAllocator.get_overflow_allocator();
489 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
490 inline void fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
491 set_overflow_allocator(
const overflow_allocator_type& allocator)
493 mAllocator.set_overflow_allocator(allocator);
500 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode>
501 inline void swap(fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode>& a,
502 fixed_hash_set<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode>& b)
514 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
515 inline fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
516 fixed_hash_multiset(
const overflow_allocator_type& overflowAllocator)
517 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), Hash(),
518 Predicate(), fixed_allocator_type(NULL, mBucketBuffer, overflowAllocator))
520 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
523 base_type::set_max_load_factor(10000.f);
525 #if EASTL_NAME_ENABLED
526 mAllocator.set_name(EASTL_FIXED_HASH_MULTISET_DEFAULT_NAME);
529 mAllocator.reset(mNodeBuffer);
533 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
534 inline fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
535 fixed_hash_multiset(
const Hash& hashFunction,
536 const Predicate& predicate)
537 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), hashFunction,
538 predicate, fixed_allocator_type(NULL, mBucketBuffer))
540 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
543 base_type::set_max_load_factor(10000.f);
545 #if EASTL_NAME_ENABLED
546 mAllocator.set_name(EASTL_FIXED_HASH_MULTISET_DEFAULT_NAME);
549 mAllocator.reset(mNodeBuffer);
553 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
554 inline fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
555 fixed_hash_multiset(
const Hash& hashFunction,
556 const Predicate& predicate,
557 const overflow_allocator_type& overflowAllocator)
558 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), hashFunction,
559 predicate, fixed_allocator_type(NULL, mBucketBuffer, overflowAllocator))
561 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
564 base_type::set_max_load_factor(10000.f);
566 #if EASTL_NAME_ENABLED
567 mAllocator.set_name(EASTL_FIXED_HASH_MULTISET_DEFAULT_NAME);
570 mAllocator.reset(mNodeBuffer);
574 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
575 template <
typename InputIterator>
576 inline fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
577 fixed_hash_multiset(InputIterator first, InputIterator last,
578 const Hash& hashFunction,
579 const Predicate& predicate)
580 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), hashFunction,
581 predicate, fixed_allocator_type(NULL, mBucketBuffer))
583 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
586 base_type::set_max_load_factor(10000.f);
588 #if EASTL_NAME_ENABLED
589 mAllocator.set_name(EASTL_FIXED_HASH_MULTISET_DEFAULT_NAME);
592 mAllocator.reset(mNodeBuffer);
593 base_type::insert(first, last);
597 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
598 inline fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
599 fixed_hash_multiset(
const this_type& x)
600 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), x.hash_function(),
601 x.equal_function(), fixed_allocator_type(NULL, mBucketBuffer))
603 mAllocator.copy_overflow_allocator(x.mAllocator);
605 #if EASTL_NAME_ENABLED
606 mAllocator.set_name(x.mAllocator.get_name());
609 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
612 base_type::set_max_load_factor(10000.f);
614 mAllocator.reset(mNodeBuffer);
615 base_type::insert(x.begin(), x.end());
619 template <
typename Key,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
620 inline fixed_hash_multiset<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::fixed_hash_multiset(this_type&& x)
621 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), x.hash_function(),
622 x.equal_function(), fixed_allocator_type(NULL, mBucketBuffer))
625 mAllocator.copy_overflow_allocator(x.mAllocator);
627 #if EASTL_NAME_ENABLED
628 mAllocator.set_name(x.mAllocator.get_name());
631 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
634 base_type::set_max_load_factor(10000.f);
636 mAllocator.reset(mNodeBuffer);
637 base_type::insert(x.begin(), x.end());
641 template <
typename Key,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
642 inline fixed_hash_multiset<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::fixed_hash_multiset(this_type&& x,
const overflow_allocator_type& overflowAllocator)
643 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount),
644 x.hash_function(), x.equal_function(), fixed_allocator_type(NULL, mBucketBuffer, overflowAllocator))
647 mAllocator.copy_overflow_allocator(x.mAllocator);
649 #if EASTL_NAME_ENABLED
650 mAllocator.set_name(x.mAllocator.get_name());
653 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
656 base_type::set_max_load_factor(10000.f);
658 mAllocator.reset(mNodeBuffer);
659 base_type::insert(x.begin(), x.end());
663 template <
typename Key,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
664 inline fixed_hash_multiset<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
666 : base_type(prime_rehash_policy::GetPrevBucketCountOnly(bucketCount), Hash(),
667 Predicate(), fixed_allocator_type(NULL, mBucketBuffer, overflowAllocator))
669 EASTL_CT_ASSERT((nodeCount >= 1) && (bucketCount >= 2));
672 base_type::set_max_load_factor(10000.f);
674 #if EASTL_NAME_ENABLED
675 mAllocator.set_name(EASTL_FIXED_HASH_MULTISET_DEFAULT_NAME);
678 mAllocator.reset(mNodeBuffer);
679 base_type::insert(ilist.begin(), ilist.end());
683 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
684 inline typename fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::this_type&
685 fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::operator=(
const this_type& x)
687 base_type::operator=(x);
692 template <
typename Key,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
693 inline typename fixed_hash_multiset<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::this_type&
694 fixed_hash_multiset<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::operator=(this_type&& x)
696 base_type::operator=(x);
701 template <
typename Key,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
702 inline typename fixed_hash_multiset<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::this_type&
703 fixed_hash_multiset<Key, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::operator=(
std::initializer_list<value_type> ilist)
706 base_type::insert(ilist.begin(), ilist.end());
711 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
712 inline void fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
716 eastl::fixed_swap(*
this, x);
720 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
721 inline void fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
724 base_type::reset_lose_memory();
725 base_type::get_allocator().reset(mNodeBuffer);
729 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
730 inline typename fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::size_type
731 fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::max_size()
const
737 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
738 inline const typename fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::overflow_allocator_type&
739 fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::get_overflow_allocator() const EA_NOEXCEPT
741 return mAllocator.get_overflow_allocator();
745 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
746 inline typename fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::overflow_allocator_type&
747 fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::get_overflow_allocator() EA_NOEXCEPT
749 return mAllocator.get_overflow_allocator();
753 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode,
typename OverflowAllocator>
754 inline void fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode, OverflowAllocator>::
755 set_overflow_allocator(
const overflow_allocator_type& allocator)
757 mAllocator.set_overflow_allocator(allocator);
765 template <
typename Value,
size_t nodeCount,
size_t bucketCount,
bool bEnableOverflow,
typename Hash,
typename Predicate,
bool bCacheHashCode>
766 inline void swap(fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode>& a,
767 fixed_hash_multiset<Value, nodeCount, bucketCount, bEnableOverflow, Hash, Predicate, bCacheHashCode>& b)
770 eastl::fixed_swap(a, b);
776 EA_RESTORE_VC_WARNING()
Definition: initializer_list.h:38
EA Standard Template Library.
Definition: algorithm.h:288
Definition: functional.h:139
Definition: functional.h:1015