HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
robin_set.h
Go to the documentation of this file.
1 /**
2  * MIT License
3  *
4  * Copyright (c) 2017 Thibaut Goetghebuer-Planchon <tessil@gmx.com>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef PXR_TSL_ROBIN_SET_H
25 #define PXR_TSL_ROBIN_SET_H
26 
27 #include <cstddef>
28 #include <functional>
29 #include <initializer_list>
30 #include <memory>
31 #include <type_traits>
32 #include <utility>
33 
34 #include "robin_hash.h"
35 
36 // Pixar modification, modify namespace for isolation.
37 #include "pxr/pxr.h"
38 
40 
41 namespace pxr_tsl {
42 
43 /**
44  * Implementation of a hash set using open-addressing and the robin hood hashing
45  * algorithm with backward shift deletion.
46  *
47  * For operations modifying the hash set (insert, erase, rehash, ...), the
48  * strong exception guarantee is only guaranteed when the expression
49  * `std::is_nothrow_swappable<Key>::value &&
50  * std::is_nothrow_move_constructible<Key>::value` is true, otherwise if an
51  * exception is thrown during the swap or the move, the hash set may end up in a
52  * undefined state. Per the standard a `Key` with a noexcept copy constructor
53  * and no move constructor also satisfies the
54  * `std::is_nothrow_move_constructible<Key>::value` criterion (and will thus
55  * guarantee the strong exception for the set).
56  *
57  * When `StoreHash` is true, 32 bits of the hash are stored alongside the
58  * values. It can improve the performance during lookups if the `KeyEqual`
59  * function takes time (or engenders a cache-miss for example) as we then
60  * compare the stored hashes before comparing the keys. When
61  * `pxr_tsl::rh::power_of_two_growth_policy` is used as `GrowthPolicy`, it may also
62  * speed-up the rehash process as we can avoid to recalculate the hash. When it
63  * is detected that storing the hash will not incur any memory penalty due to
64  * alignment (i.e. `sizeof(pxr_tsl::detail_robin_hash::bucket_entry<ValueType,
65  * true>) == sizeof(pxr_tsl::detail_robin_hash::bucket_entry<ValueType, false>)`)
66  * and `pxr_tsl::rh::power_of_two_growth_policy` is used, the hash will be stored
67  * even if `StoreHash` is false so that we can speed-up the rehash (but it will
68  * not be used on lookups unless `StoreHash` is true).
69  *
70  * `GrowthPolicy` defines how the set grows and consequently how a hash value is
71  * mapped to a bucket. By default the set uses
72  * `pxr_tsl::rh::power_of_two_growth_policy`. This policy keeps the number of
73  * buckets to a power of two and uses a mask to set the hash to a bucket instead
74  * of the slow modulo. Other growth policies are available and you may define
75  * your own growth policy, check `pxr_tsl::rh::power_of_two_growth_policy` for the
76  * interface.
77  *
78  * `Key` must be swappable.
79  *
80  * `Key` must be copy and/or move constructible.
81  *
82  * If the destructor of `Key` throws an exception, the behaviour of the class is
83  * undefined.
84  *
85  * Iterators invalidation:
86  * - clear, operator=, reserve, rehash: always invalidate the iterators.
87  * - insert, emplace, emplace_hint, operator[]: if there is an effective
88  * insert, invalidate the iterators.
89  * - erase: always invalidate the iterators.
90  */
91 template <class Key, class Hash = std::hash<Key>,
92  class KeyEqual = std::equal_to<Key>,
93  class Allocator = std::allocator<Key>, bool StoreHash = false,
94  class GrowthPolicy = pxr_tsl::rh::power_of_two_growth_policy<2>>
95 class robin_set {
96  private:
97  template <typename U>
99 
100  class KeySelect {
101  public:
102  using key_type = Key;
103 
104  const key_type& operator()(const Key& key) const noexcept { return key; }
105 
106  key_type& operator()(Key& key) noexcept { return key; }
107  };
108 
109  using ht = detail_robin_hash::robin_hash<Key, KeySelect, void, Hash, KeyEqual,
110  Allocator, StoreHash, GrowthPolicy>;
111 
112  public:
113  using key_type = typename ht::key_type;
114  using value_type = typename ht::value_type;
115  using size_type = typename ht::size_type;
117  using hasher = typename ht::hasher;
118  using key_equal = typename ht::key_equal;
120  using reference = typename ht::reference;
122  using pointer = typename ht::pointer;
124  using iterator = typename ht::iterator;
126 
127  /*
128  * Constructors
129  */
130  robin_set() : robin_set(ht::DEFAULT_INIT_BUCKETS_SIZE) {}
131 
132  explicit robin_set(size_type bucket_count, const Hash& hash = Hash(),
133  const KeyEqual& equal = KeyEqual(),
134  const Allocator& alloc = Allocator())
135  : m_ht(bucket_count, hash, equal, alloc) {}
136 
137  robin_set(size_type bucket_count, const Allocator& alloc)
138  : robin_set(bucket_count, Hash(), KeyEqual(), alloc) {}
139 
140  robin_set(size_type bucket_count, const Hash& hash, const Allocator& alloc)
141  : robin_set(bucket_count, hash, KeyEqual(), alloc) {}
142 
143  explicit robin_set(const Allocator& alloc)
144  : robin_set(ht::DEFAULT_INIT_BUCKETS_SIZE, alloc) {}
145 
146  template <class InputIt>
147  robin_set(InputIt first, InputIt last,
149  const Hash& hash = Hash(), const KeyEqual& equal = KeyEqual(),
150  const Allocator& alloc = Allocator())
151  : robin_set(bucket_count, hash, equal, alloc) {
152  insert(first, last);
153  }
154 
155  template <class InputIt>
156  robin_set(InputIt first, InputIt last, size_type bucket_count,
157  const Allocator& alloc)
158  : robin_set(first, last, bucket_count, Hash(), KeyEqual(), alloc) {}
159 
160  template <class InputIt>
161  robin_set(InputIt first, InputIt last, size_type bucket_count,
162  const Hash& hash, const Allocator& alloc)
163  : robin_set(first, last, bucket_count, hash, KeyEqual(), alloc) {}
164 
165  robin_set(std::initializer_list<value_type> init,
167  const Hash& hash = Hash(), const KeyEqual& equal = KeyEqual(),
168  const Allocator& alloc = Allocator())
169  : robin_set(init.begin(), init.end(), bucket_count, hash, equal, alloc) {}
170 
171  robin_set(std::initializer_list<value_type> init, size_type bucket_count,
172  const Allocator& alloc)
173  : robin_set(init.begin(), init.end(), bucket_count, Hash(), KeyEqual(),
174  alloc) {}
175 
176  robin_set(std::initializer_list<value_type> init, size_type bucket_count,
177  const Hash& hash, const Allocator& alloc)
178  : robin_set(init.begin(), init.end(), bucket_count, hash, KeyEqual(),
179  alloc) {}
180 
181  robin_set& operator=(std::initializer_list<value_type> ilist) {
182  m_ht.clear();
183 
184  m_ht.reserve(ilist.size());
185  m_ht.insert(ilist.begin(), ilist.end());
186 
187  return *this;
188  }
189 
190  allocator_type get_allocator() const { return m_ht.get_allocator(); }
191 
192  /*
193  * Iterators
194  */
195  iterator begin() noexcept { return m_ht.begin(); }
196  const_iterator begin() const noexcept { return m_ht.begin(); }
197  const_iterator cbegin() const noexcept { return m_ht.cbegin(); }
198 
199  iterator end() noexcept { return m_ht.end(); }
200  const_iterator end() const noexcept { return m_ht.end(); }
201  const_iterator cend() const noexcept { return m_ht.cend(); }
202 
203  /*
204  * Capacity
205  */
206  bool empty() const noexcept { return m_ht.empty(); }
207  size_type size() const noexcept { return m_ht.size(); }
208  size_type max_size() const noexcept { return m_ht.max_size(); }
209 
210  /*
211  * Modifiers
212  */
213  void clear() noexcept { m_ht.clear(); }
214 
215  std::pair<iterator, bool> insert(const value_type& value) {
216  return m_ht.insert(value);
217  }
218 
219  std::pair<iterator, bool> insert(value_type&& value) {
220  return m_ht.insert(std::move(value));
221  }
222 
224  return m_ht.insert_hint(hint, value);
225  }
226 
228  return m_ht.insert_hint(hint, std::move(value));
229  }
230 
231  template <class InputIt>
232  void insert(InputIt first, InputIt last) {
233  m_ht.insert(first, last);
234  }
235 
236  void insert(std::initializer_list<value_type> ilist) {
237  m_ht.insert(ilist.begin(), ilist.end());
238  }
239 
240  /**
241  * Due to the way elements are stored, emplace will need to move or copy the
242  * key-value once. The method is equivalent to
243  * insert(value_type(std::forward<Args>(args)...));
244  *
245  * Mainly here for compatibility with the std::unordered_map interface.
246  */
247  template <class... Args>
248  std::pair<iterator, bool> emplace(Args&&... args) {
249  return m_ht.emplace(std::forward<Args>(args)...);
250  }
251 
252  /**
253  * Due to the way elements are stored, emplace_hint will need to move or copy
254  * the key-value once. The method is equivalent to insert(hint,
255  * value_type(std::forward<Args>(args)...));
256  *
257  * Mainly here for compatibility with the std::unordered_map interface.
258  */
259  template <class... Args>
261  return m_ht.emplace_hint(hint, std::forward<Args>(args)...);
262  }
263 
264  iterator erase(iterator pos) { return m_ht.erase(pos); }
265  iterator erase(const_iterator pos) { return m_ht.erase(pos); }
267  return m_ht.erase(first, last);
268  }
269  size_type erase(const key_type& key) { return m_ht.erase(key); }
270 
271  /**
272  * Use the hash value 'precalculated_hash' instead of hashing the key. The
273  * hash value should be the same as hash_function()(key). Useful to speed-up
274  * the lookup to the value if you already have the hash.
275  */
276  size_type erase(const key_type& key, std::size_t precalculated_hash) {
277  return m_ht.erase(key, precalculated_hash);
278  }
279 
280  /**
281  * This overload only participates in the overload resolution if the typedef
282  * KeyEqual::is_transparent exists. If so, K must be hashable and comparable
283  * to Key.
284  */
285  template <
286  class K, class KE = KeyEqual,
288  size_type erase(const K& key) {
289  return m_ht.erase(key);
290  }
291 
292  /**
293  * @copydoc erase(const K& key)
294  *
295  * Use the hash value 'precalculated_hash' instead of hashing the key. The
296  * hash value should be the same as hash_function()(key). Useful to speed-up
297  * the lookup to the value if you already have the hash.
298  */
299  template <
300  class K, class KE = KeyEqual,
302  size_type erase(const K& key, std::size_t precalculated_hash) {
303  return m_ht.erase(key, precalculated_hash);
304  }
305 
306  void swap(robin_set& other) { other.m_ht.swap(m_ht); }
307 
308  /*
309  * Lookup
310  */
311  size_type count(const Key& key) const { return m_ht.count(key); }
312 
313  /**
314  * Use the hash value 'precalculated_hash' instead of hashing the key. The
315  * hash value should be the same as hash_function()(key). Useful to speed-up
316  * the lookup if you already have the hash.
317  */
318  size_type count(const Key& key, std::size_t precalculated_hash) const {
319  return m_ht.count(key, precalculated_hash);
320  }
321 
322  /**
323  * This overload only participates in the overload resolution if the typedef
324  * KeyEqual::is_transparent exists. If so, K must be hashable and comparable
325  * to Key.
326  */
327  template <
328  class K, class KE = KeyEqual,
330  size_type count(const K& key) const {
331  return m_ht.count(key);
332  }
333 
334  /**
335  * @copydoc count(const K& key) const
336  *
337  * Use the hash value 'precalculated_hash' instead of hashing the key. The
338  * hash value should be the same as hash_function()(key). Useful to speed-up
339  * the lookup if you already have the hash.
340  */
341  template <
342  class K, class KE = KeyEqual,
344  size_type count(const K& key, std::size_t precalculated_hash) const {
345  return m_ht.count(key, precalculated_hash);
346  }
347 
348  iterator find(const Key& key) { return m_ht.find(key); }
349 
350  /**
351  * Use the hash value 'precalculated_hash' instead of hashing the key. The
352  * hash value should be the same as hash_function()(key). Useful to speed-up
353  * the lookup if you already have the hash.
354  */
355  iterator find(const Key& key, std::size_t precalculated_hash) {
356  return m_ht.find(key, precalculated_hash);
357  }
358 
359  const_iterator find(const Key& key) const { return m_ht.find(key); }
360 
361  /**
362  * @copydoc find(const Key& key, std::size_t precalculated_hash)
363  */
364  const_iterator find(const Key& key, std::size_t precalculated_hash) const {
365  return m_ht.find(key, precalculated_hash);
366  }
367 
368  /**
369  * This overload only participates in the overload resolution if the typedef
370  * KeyEqual::is_transparent exists. If so, K must be hashable and comparable
371  * to Key.
372  */
373  template <
374  class K, class KE = KeyEqual,
376  iterator find(const K& key) {
377  return m_ht.find(key);
378  }
379 
380  /**
381  * @copydoc find(const K& key)
382  *
383  * Use the hash value 'precalculated_hash' instead of hashing the key. The
384  * hash value should be the same as hash_function()(key). Useful to speed-up
385  * the lookup if you already have the hash.
386  */
387  template <
388  class K, class KE = KeyEqual,
390  iterator find(const K& key, std::size_t precalculated_hash) {
391  return m_ht.find(key, precalculated_hash);
392  }
393 
394  /**
395  * @copydoc find(const K& key)
396  */
397  template <
398  class K, class KE = KeyEqual,
400  const_iterator find(const K& key) const {
401  return m_ht.find(key);
402  }
403 
404  /**
405  * @copydoc find(const K& key)
406  *
407  * Use the hash value 'precalculated_hash' instead of hashing the key. The
408  * hash value should be the same as hash_function()(key). Useful to speed-up
409  * the lookup if you already have the hash.
410  */
411  template <
412  class K, class KE = KeyEqual,
414  const_iterator find(const K& key, std::size_t precalculated_hash) const {
415  return m_ht.find(key, precalculated_hash);
416  }
417 
418  bool contains(const Key& key) const { return m_ht.contains(key); }
419 
420  /**
421  * Use the hash value 'precalculated_hash' instead of hashing the key. The
422  * hash value should be the same as hash_function()(key). Useful to speed-up
423  * the lookup if you already have the hash.
424  */
425  bool contains(const Key& key, std::size_t precalculated_hash) const {
426  return m_ht.contains(key, precalculated_hash);
427  }
428 
429  /**
430  * This overload only participates in the overload resolution if the typedef
431  * KeyEqual::is_transparent exists. If so, K must be hashable and comparable
432  * to Key.
433  */
434  template <
435  class K, class KE = KeyEqual,
437  bool contains(const K& key) const {
438  return m_ht.contains(key);
439  }
440 
441  /**
442  * @copydoc contains(const K& key) const
443  *
444  * Use the hash value 'precalculated_hash' instead of hashing the key. The
445  * hash value should be the same as hash_function()(key). Useful to speed-up
446  * the lookup if you already have the hash.
447  */
448  template <
449  class K, class KE = KeyEqual,
451  bool contains(const K& key, std::size_t precalculated_hash) const {
452  return m_ht.contains(key, precalculated_hash);
453  }
454 
455  std::pair<iterator, iterator> equal_range(const Key& key) {
456  return m_ht.equal_range(key);
457  }
458 
459  /**
460  * Use the hash value 'precalculated_hash' instead of hashing the key. The
461  * hash value should be the same as hash_function()(key). Useful to speed-up
462  * the lookup if you already have the hash.
463  */
464  std::pair<iterator, iterator> equal_range(const Key& key,
465  std::size_t precalculated_hash) {
466  return m_ht.equal_range(key, precalculated_hash);
467  }
468 
469  std::pair<const_iterator, const_iterator> equal_range(const Key& key) const {
470  return m_ht.equal_range(key);
471  }
472 
473  /**
474  * @copydoc equal_range(const Key& key, std::size_t precalculated_hash)
475  */
476  std::pair<const_iterator, const_iterator> equal_range(
477  const Key& key, std::size_t precalculated_hash) const {
478  return m_ht.equal_range(key, precalculated_hash);
479  }
480 
481  /**
482  * This overload only participates in the overload resolution if the typedef
483  * KeyEqual::is_transparent exists. If so, K must be hashable and comparable
484  * to Key.
485  */
486  template <
487  class K, class KE = KeyEqual,
489  std::pair<iterator, iterator> equal_range(const K& key) {
490  return m_ht.equal_range(key);
491  }
492 
493  /**
494  * @copydoc equal_range(const K& key)
495  *
496  * Use the hash value 'precalculated_hash' instead of hashing the key. The
497  * hash value should be the same as hash_function()(key). Useful to speed-up
498  * the lookup if you already have the hash.
499  */
500  template <
501  class K, class KE = KeyEqual,
503  std::pair<iterator, iterator> equal_range(const K& key,
504  std::size_t precalculated_hash) {
505  return m_ht.equal_range(key, precalculated_hash);
506  }
507 
508  /**
509  * @copydoc equal_range(const K& key)
510  */
511  template <
512  class K, class KE = KeyEqual,
514  std::pair<const_iterator, const_iterator> equal_range(const K& key) const {
515  return m_ht.equal_range(key);
516  }
517 
518  /**
519  * @copydoc equal_range(const K& key, std::size_t precalculated_hash)
520  */
521  template <
522  class K, class KE = KeyEqual,
524  std::pair<const_iterator, const_iterator> equal_range(
525  const K& key, std::size_t precalculated_hash) const {
526  return m_ht.equal_range(key, precalculated_hash);
527  }
528 
529  /*
530  * Bucket interface
531  */
532  size_type bucket_count() const { return m_ht.bucket_count(); }
533  size_type max_bucket_count() const { return m_ht.max_bucket_count(); }
534 
535  /*
536  * Hash policy
537  */
538  float load_factor() const { return m_ht.load_factor(); }
539 
540  float min_load_factor() const { return m_ht.min_load_factor(); }
541  float max_load_factor() const { return m_ht.max_load_factor(); }
542 
543  /**
544  * Set the `min_load_factor` to `ml`. When the `load_factor` of the set goes
545  * below `min_load_factor` after some erase operations, the set will be
546  * shrunk when an insertion occurs. The erase method itself never shrinks
547  * the set.
548  *
549  * The default value of `min_load_factor` is 0.0f, the set never shrinks by
550  * default.
551  */
552  void min_load_factor(float ml) { m_ht.min_load_factor(ml); }
553  void max_load_factor(float ml) { m_ht.max_load_factor(ml); }
554 
555  void rehash(size_type count_) { m_ht.rehash(count_); }
556  void reserve(size_type count_) { m_ht.reserve(count_); }
557 
558  /*
559  * Observers
560  */
561  hasher hash_function() const { return m_ht.hash_function(); }
562  key_equal key_eq() const { return m_ht.key_eq(); }
563 
564  /*
565  * Other
566  */
567 
568  /**
569  * Convert a const_iterator to an iterator.
570  */
572  return m_ht.mutable_iterator(pos);
573  }
574 
575  friend bool operator==(const robin_set& lhs, const robin_set& rhs) {
576  if (lhs.size() != rhs.size()) {
577  return false;
578  }
579 
580  for (const auto& element_lhs : lhs) {
581  const auto it_element_rhs = rhs.find(element_lhs);
582  if (it_element_rhs == rhs.cend()) {
583  return false;
584  }
585  }
586 
587  return true;
588  }
589 
590  /**
591  * Serialize the set through the `serializer` parameter.
592  *
593  * The `serializer` parameter must be a function object that supports the
594  * following call:
595  * - `template<typename U> void operator()(const U& value);` where the types
596  * `std::int16_t`, `std::uint32_t`, `std::uint64_t`, `float` and `Key` must be
597  * supported for U.
598  *
599  * The implementation leaves binary compatibility (endianness, IEEE 754 for
600  * floats, ...) of the types it serializes in the hands of the `Serializer`
601  * function object if compatibility is required.
602  */
603  template <class Serializer>
604  void serialize(Serializer& serializer) const {
605  m_ht.serialize(serializer);
606  }
607 
608  /**
609  * Deserialize a previously serialized set through the `deserializer`
610  * parameter.
611  *
612  * The `deserializer` parameter must be a function object that supports the
613  * following call:
614  * - `template<typename U> U operator()();` where the types `std::int16_t`,
615  * `std::uint32_t`, `std::uint64_t`, `float` and `Key` must be supported for
616  * U.
617  *
618  * If the deserialized hash set type is hash compatible with the serialized
619  * set, the deserialization process can be sped up by setting
620  * `hash_compatible` to true. To be hash compatible, the Hash, KeyEqual and
621  * GrowthPolicy must behave the same way than the ones used on the serialized
622  * set and the StoreHash must have the same value. The `std::size_t` must also
623  * be of the same size as the one on the platform used to serialize the set.
624  * If these criteria are not met, the behaviour is undefined with
625  * `hash_compatible` sets to true.
626  *
627  * The behaviour is undefined if the type `Key` of the `robin_set` is not the
628  * same as the type used during serialization.
629  *
630  * The implementation leaves binary compatibility (endianness, IEEE 754 for
631  * floats, size of int, ...) of the types it deserializes in the hands of the
632  * `Deserializer` function object if compatibility is required.
633  */
634  template <class Deserializer>
635  static robin_set deserialize(Deserializer& deserializer,
636  bool hash_compatible = false) {
637  robin_set set(0);
638  set.m_ht.deserialize(deserializer, hash_compatible);
639 
640  return set;
641  }
642 
643  friend bool operator!=(const robin_set& lhs, const robin_set& rhs) {
644  return !operator==(lhs, rhs);
645  }
646 
647  friend void swap(robin_set& lhs, robin_set& rhs) { lhs.swap(rhs); }
648 
649  private:
650  ht m_ht;
651 };
652 
653 /**
654  * Same as `pxr_tsl::robin_set<Key, Hash, KeyEqual, Allocator, StoreHash,
655  * pxr_tsl::rh::prime_growth_policy>`.
656  */
657 template <class Key, class Hash = std::hash<Key>,
658  class KeyEqual = std::equal_to<Key>,
659  class Allocator = std::allocator<Key>, bool StoreHash = false>
660 using robin_pg_set = robin_set<Key, Hash, KeyEqual, Allocator, StoreHash,
662 
663 } // end namespace pxr_tsl
664 
666 
667 #endif
iterator erase(const_iterator pos)
Definition: robin_set.h:265
robin_set(InputIt first, InputIt last, size_type bucket_count, const Hash &hash, const Allocator &alloc)
Definition: robin_set.h:161
iterator erase(iterator pos)
Definition: robin_set.h:264
GLint first
Definition: glcorearb.h:405
typename ht::allocator_type allocator_type
Definition: robin_set.h:119
iterator find(const Key &key, std::size_t precalculated_hash)
Definition: robin_set.h:355
size_type bucket_count() const
Definition: robin_set.h:532
iterator emplace_hint(const_iterator hint, Args &&...args)
Definition: robin_hash.h:800
void reserve(size_type count_)
Definition: robin_set.h:556
float min_load_factor() const
Definition: robin_set.h:540
void deserialize(Deserializer &deserializer, bool hash_compatible)
Definition: robin_hash.h:1113
STATIC_INLINE size_t Hash(const char *s, size_t len)
Definition: farmhash.h:2038
iterator mutable_iterator(const_iterator pos)
Definition: robin_set.h:571
void
Definition: png.h:1083
void max_load_factor(float ml)
Definition: robin_set.h:553
robin_set< Key, Hash, KeyEqual, Allocator, StoreHash, pxr_tsl::rh::prime_growth_policy > robin_pg_set
Definition: robin_set.h:661
typename ht::iterator iterator
Definition: robin_set.h:124
GLsizei const GLfloat * value
Definition: glcorearb.h:824
float load_factor() const
Definition: robin_set.h:538
hasher hash_function() const
Definition: robin_set.h:561
typename ht::key_equal key_equal
Definition: robin_set.h:118
const_iterator find(const Key &key) const
Definition: robin_set.h:359
bool contains(const Key &key, std::size_t precalculated_hash) const
Definition: robin_set.h:425
std::pair< iterator, iterator > equal_range(const Key &key)
Definition: robin_set.h:455
iterator emplace_hint(const_iterator hint, Args &&...args)
Definition: robin_set.h:260
void swap(robin_hash &other)
Definition: robin_hash.h:924
iterator insert(const_iterator hint, value_type &&value)
Definition: robin_set.h:227
std::pair< iterator, bool > insert(value_type &&value)
Definition: robin_set.h:219
void serialize(Serializer &serializer) const
Definition: robin_hash.h:1108
iterator end() noexcept
Definition: robin_set.h:199
const_iterator find(const K &key) const
Definition: robin_set.h:400
IMATH_HOSTDEVICE constexpr bool equal(T1 a, T2 b, T3 t) IMATH_NOEXCEPT
Definition: ImathFun.h:105
std::pair< iterator, iterator > equal_range(const K &key)
Definition: robin_hash.h:1025
std::pair< iterator, iterator > equal_range(const Key &key, std::size_t precalculated_hash)
Definition: robin_set.h:464
bool contains(const K &key) const
Definition: robin_hash.h:1015
bool contains(const Key &key) const
Definition: robin_set.h:418
friend bool operator==(const robin_set &lhs, const robin_set &rhs)
Definition: robin_set.h:575
size_type erase(const key_type &key, std::size_t precalculated_hash)
Definition: robin_set.h:276
typename ht::const_reference const_reference
Definition: robin_set.h:121
std::pair< iterator, bool > emplace(Args &&...args)
Definition: robin_set.h:248
robin_set(std::initializer_list< value_type > init, size_type bucket_count, const Allocator &alloc)
Definition: robin_set.h:171
void insert(InputIt first, InputIt last)
Definition: robin_set.h:232
std::pair< iterator, iterator > equal_range(const K &key, std::size_t precalculated_hash)
Definition: robin_set.h:503
size_type count(const Key &key) const
Definition: robin_set.h:311
std::pair< iterator, bool > emplace(Args &&...args)
Definition: robin_hash.h:795
robin_set(InputIt first, InputIt last, size_type bucket_count, const Allocator &alloc)
Definition: robin_set.h:156
size_type count(const Key &key, std::size_t precalculated_hash) const
Definition: robin_set.h:318
std::pair< const_iterator, const_iterator > equal_range(const K &key) const
Definition: robin_set.h:514
iterator insert_hint(const_iterator hint, P &&value)
Definition: robin_hash.h:743
size_type size() const noexcept
Definition: robin_set.h:207
const_iterator cbegin() const noexcept
Definition: robin_set.h:197
size_type count(const K &key) const
Definition: robin_hash.h:981
const_iterator find(const Key &key, std::size_t precalculated_hash) const
Definition: robin_set.h:364
const_iterator cend() const noexcept
Definition: robin_hash.h:708
void rehash(size_type count_)
Definition: robin_set.h:555
robin_set(std::initializer_list< value_type > init, size_type bucket_count=ht::DEFAULT_INIT_BUCKETS_SIZE, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
Definition: robin_set.h:165
robin_set(const Allocator &alloc)
Definition: robin_set.h:143
typename ht::difference_type difference_type
Definition: robin_set.h:116
size_type count(const K &key, std::size_t precalculated_hash) const
Definition: robin_set.h:344
const_iterator begin() const noexcept
Definition: robin_set.h:196
iterator find(const K &key)
Definition: robin_set.h:376
robin_set(InputIt first, InputIt last, size_type bucket_count=ht::DEFAULT_INIT_BUCKETS_SIZE, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
Definition: robin_set.h:147
typename ht::const_pointer const_pointer
Definition: robin_set.h:123
void insert(std::initializer_list< value_type > ilist)
Definition: robin_set.h:236
friend bool operator!=(const robin_set &lhs, const robin_set &rhs)
Definition: robin_set.h:643
static robin_set deserialize(Deserializer &deserializer, bool hash_compatible=false)
Definition: robin_set.h:635
const_iterator find(const K &key, std::size_t precalculated_hash) const
Definition: robin_set.h:414
GLuint GLuint end
Definition: glcorearb.h:475
friend void swap(robin_set &lhs, robin_set &rhs)
Definition: robin_set.h:647
size_type erase(const K &key)
Definition: robin_set.h:288
std::pair< iterator, bool > insert(P &&value)
Definition: robin_hash.h:738
iterator begin() noexcept
Definition: robin_set.h:195
bool empty() const noexcept
Definition: robin_set.h:206
void clear() noexcept
Definition: robin_set.h:213
typename ht::pointer pointer
Definition: robin_set.h:122
size_type max_size() const noexcept
Definition: robin_hash.h:719
robin_set(size_type bucket_count, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
Definition: robin_set.h:132
iterator erase(const_iterator first, const_iterator last)
Definition: robin_set.h:266
typename ht::reference reference
Definition: robin_set.h:120
void min_load_factor(float ml)
Definition: robin_set.h:552
typename ht::value_type value_type
Definition: robin_set.h:114
size_type erase(const K &key, std::size_t precalculated_hash)
Definition: robin_set.h:302
const_iterator cbegin() const noexcept
Definition: robin_hash.h:695
std::pair< const_iterator, const_iterator > equal_range(const Key &key, std::size_t precalculated_hash) const
Definition: robin_set.h:476
size_type erase(const key_type &key)
Definition: robin_set.h:269
key_equal key_eq() const
Definition: robin_set.h:562
std::pair< iterator, bool > insert(const value_type &value)
Definition: robin_set.h:215
iterator mutable_iterator(const_iterator pos)
Definition: robin_hash.h:1103
std::pair< iterator, iterator > equal_range(const K &key)
Definition: robin_set.h:489
bool contains(const K &key, std::size_t precalculated_hash) const
Definition: robin_set.h:451
size_type max_size() const noexcept
Definition: robin_set.h:208
robin_set(std::initializer_list< value_type > init, size_type bucket_count, const Hash &hash, const Allocator &alloc)
Definition: robin_set.h:176
const_iterator cend() const noexcept
Definition: robin_set.h:201
size_type max_bucket_count() const
Definition: robin_set.h:533
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
std::pair< const_iterator, const_iterator > equal_range(const K &key, std::size_t precalculated_hash) const
Definition: robin_set.h:524
const_iterator end() const noexcept
Definition: robin_set.h:200
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
iterator insert(const_iterator hint, const value_type &value)
Definition: robin_set.h:223
**If you just want to fire and args
Definition: thread.h:609
size_type size() const noexcept
Definition: robin_hash.h:717
robin_set(size_type bucket_count, const Allocator &alloc)
Definition: robin_set.h:137
void serialize(Serializer &serializer) const
Definition: robin_set.h:604
size_type count(const K &key) const
Definition: robin_set.h:330
Definition: core.h:1131
robin_set(size_type bucket_count, const Hash &hash, const Allocator &alloc)
Definition: robin_set.h:140
void swap(robin_set &other)
Definition: robin_set.h:306
#define const
Definition: zconf.h:214
allocator_type get_allocator() const
Definition: robin_hash.h:677
bool contains(const K &key) const
Definition: robin_set.h:437
type
Definition: core.h:1059
iterator find(const Key &key)
Definition: robin_set.h:348
allocator_type get_allocator() const
Definition: robin_set.h:190
float max_load_factor() const
Definition: robin_set.h:541
iterator find(const K &key, std::size_t precalculated_hash)
Definition: robin_set.h:390
typename ht::hasher hasher
Definition: robin_set.h:117
std::pair< const_iterator, const_iterator > equal_range(const Key &key) const
Definition: robin_set.h:469
typename ht::key_type key_type
Definition: robin_set.h:113
typename ht::size_type size_type
Definition: robin_set.h:115
typename ht::const_iterator const_iterator
Definition: robin_set.h:125
robin_set & operator=(std::initializer_list< value_type > ilist)
Definition: robin_set.h:181