AGX Dynamics  2.35.0.1
LinearProbingHashTable.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 
18 // Inspired by Emil Ernerfeldt:
19 // https://github.com/emilk/emilib/tree/master/emilib
20 // LICENSE:
21 // This software is dual-licensed to the public domain and under the following
22 // license: you are granted a perpetual, irrevocable license to copy, modify,
23 // publish, and distribute this file as you see fit.
24 
25 
26 
27 
28 
29 #ifndef AGX_LINEAR_PROBING_HASH_TABLE_H
30 #define AGX_LINEAR_PROBING_HASH_TABLE_H
31 
32 #include <cstdlib>
33 #include <iterator>
34 #include <utility>
35 
36 #include <agx/ref_ptr.h>
37 #include <agx/hash.h>
38 
39 #include <agx/Allocator.h>
40 
41 namespace agx
42 {
46 template <typename KeyT, typename ValueT, typename HashT = agx::HashFn<KeyT>, typename AllocatorT = ByteAllocator>
48 {
49 private:
51  using PairT = std::pair<KeyT, ValueT>;
52  enum class State : uint8_t
53  {
54  INACTIVE, // Never been touched
55  ACTIVE, // Is inside a search-chain, but is empty
56  FILLED // Is set with key/value
57  };
58 
59 
60 public:
61  using key_type = KeyT;
62  using size_type = size_t;
63  using value_type = ValueT;
64  using bucket_type = PairT;
65  using reference = PairT&;
66  using const_reference = const PairT&;
67 
68  // The quadratic probing hash table supports various types of behavior when
69  // clearing. The linear probing hash table does not.
70  //
71  // We repeat the clear policy type here so that users can compile, even though
72  // the value is ignored for now.
74  {
78  };
79 
80 
81 
82  class iterator
83  {
84  public:
85  using iterator_category = std::forward_iterator_tag;
86  using difference_type = size_t;
87  using distance_type = size_t;
88  using bucket_type = std::pair<KeyT, ValueT>;
89  using pointer = bucket_type*;
91 
92  iterator() { }
93 
94  iterator(MyType* hash_map, size_t bucket) : _map(hash_map), _bucket(bucket)
95  {
96  }
97 
99  {
100  this->goto_next_element();
101  return *this;
102  }
103 
105  {
106  size_t old_index = _bucket;
107  this->goto_next_element();
108  return iterator(_map, old_index);
109  }
110 
114  {
115  this->goto_previous_element();
116  return *this;
117  }
118 
122  {
123  size_t old_index = _bucket;
124  this->goto_previous_element();
125  return iterator(_map, old_index);
126  }
127 
129  {
130  return _map->_pairs[_bucket];
131  }
132 
134  {
135  return _map->_pairs + _bucket;
136  }
137 
138  bool operator==(const iterator& rhs) const
139  {
140  agxAssert(_map == rhs._map);
141  return this->_bucket == rhs._bucket;
142  }
143 
144  bool operator!=(const iterator& rhs) const
145  {
146  agxAssert(_map == rhs._map);
147  return this->_bucket != rhs._bucket;
148  }
149 
150  private:
151  void goto_next_element()
152  {
153  agxAssert(_bucket < _map->_num_buckets);
154  do {
155  _bucket++;
156  } while (_bucket < _map->_num_buckets && _map->_states[_bucket] != State::FILLED);
157  }
158 
159  // This is tremendously dangerous. There is currently no way of detecting
160  // that we've reached rend since there is no rend.
161  void goto_previous_element()
162  {
163  agxAssert(_bucket > 0);
164 
165  do {
166  _bucket--;
167  } while(_bucket > 0 && _map->_states[_bucket] != State::FILLED);
168 
169  agxAssert(_map->_states[_bucket] == State::FILLED);
170  }
171 
172  public:
174  size_t _bucket;
175  };
176 
178  {
179  public:
180  using iterator_category = std::forward_iterator_tag;
181  using difference_type = size_t;
182  using distance_type = size_t;
183  using bucket_type = std::pair<KeyT, ValueT>;
186 
188 
189  const_iterator(iterator proto) : _map(proto._map), _bucket(proto._bucket)
190  {
191  }
192 
193  const_iterator(const MyType* hash_map, size_t bucket) : _map(hash_map), _bucket(bucket)
194  {
195  }
196 
198  {
199  this->goto_next_element();
200  return *this;
201  }
202 
204  {
205  size_t old_index = _bucket;
206  this->goto_next_element();
207  return const_iterator(_map, old_index);
208  }
209 
213  {
214  this->goto_previous_element();
215  return *this;
216  }
217 
221  {
222  size_t old_index = _bucket;
223  this->goto_previous_element();
224  return iterator(_map, old_index);
225  }
226 
228  {
229  return _map->_pairs[_bucket];
230  }
231 
233  {
234  return _map->_pairs + _bucket;
235  }
236 
237  bool operator==(const const_iterator& rhs) const
238  {
239  agxAssert(_map == rhs._map);
240  return this->_bucket == rhs._bucket;
241  }
242 
243  bool operator!=(const const_iterator& rhs) const
244  {
245  agxAssert(_map == rhs._map);
246  return this->_bucket != rhs._bucket;
247  }
248 
249  private:
250  void goto_next_element()
251  {
252  agxAssert(_bucket < _map->_num_buckets);
253  do {
254  _bucket++;
255  } while (_bucket < _map->_num_buckets && _map->_states[_bucket] != State::FILLED);
256  }
257 
258  // This is tremendously dangerous. There is currently no way of detecting
259  // that we've reached rend since there is no rend.
260  void goto_previous_element()
261  {
262  agxAssert(_bucket > 0);
263 
264  do {
265  _bucket--;
266  } while(_bucket > 0 && _map->_states[_bucket] != State::FILLED);
267 
268  agxAssert(_map->_states[_bucket] == State::FILLED);
269  }
270 
271  //private:
272  // friend class MyType;
273  public:
274  const MyType* _map;
275  size_t _bucket;
276  };
277 
278  class insert_iterator : public iterator
279  {
280  public:
281  insert_iterator() : iterator(), m_overwrite(false)
282  {
283  }
284 
285  insert_iterator(MyType* hash_map, size_t bucket, bool overwrite) :
286  iterator(hash_map, bucket), m_overwrite(overwrite)
287  {
288  }
289 
293  bool didOverwrite() const
294  {
295  return m_overwrite;
296  }
297 
298  private:
299  bool m_overwrite;
300  };
301 
302  // ------------------------------------------------------------------------
303 
305 
307  {
308  reserve(other.size());
309  insert(cbegin(other), cend(other));
310  }
311 
313  {
314  *this = std::move(other);
315  }
316 
318  {
319  clear();
320  reserve(other.size());
321  insert(cbegin(other), cend(other));
322  return *this;
323  }
324 
326  {
327  this->swap(other);
328  return *this;
329  }
330 
332  {
333  for (size_t bucket=0; bucket<_num_buckets; ++bucket) {
334  if (_states[bucket] == State::FILLED) {
335  _pairs[bucket].~PairT();
336  }
337  }
338 
339  _allocator.deallocateBytes(_states, _num_buckets * sizeof(State));
340  _allocator.deallocateBytes(_pairs, _num_buckets * sizeof(PairT));
341  }
342 
344  {
345  std::swap(_hasher, other._hasher);
346  std::swap(_allocator, other._allocator);
347  std::swap(_states, other._states);
348  std::swap(_pairs, other._pairs);
349  std::swap(_num_buckets, other._num_buckets);
350  std::swap(_num_filled, other._num_filled);
351  std::swap(_max_probe_length, other._max_probe_length);
352  std::swap(_mask, other._mask);
353  }
354 
355  // -------------------------------------------------------------
356 
361  {
362  size_t bucket = 0;
363  while (bucket<_num_buckets && _states[bucket] != State::FILLED) {
364  ++bucket;
365  }
366  return iterator(this, bucket);
367  }
368 
373  {
374  size_t bucket = 0;
375  while (bucket<_num_buckets && _states[bucket] != State::FILLED) {
376  ++bucket;
377  }
378  return const_iterator(this, bucket);
379  }
380 
381 
386  { return iterator(this, _num_buckets); }
387 
388 
393  { return const_iterator(this, _num_buckets); }
394 
398  size_t size() const
399  {
400  return _num_filled;
401  }
402 
406  size_t capacity() const
407  {
408  return _num_buckets;
409  }
410 
414  bool empty() const
415  {
416  return _num_filled==0;
417  }
418 
419  // ------------------------------------------------------------
420 
426  iterator find(const KeyT& key)
427  {
428  auto bucket = this->find_filled_bucket(key);
429  if (bucket == (size_t)-1) {
430  return this->end();
431  }
432  return iterator(this, bucket);
433  }
434 
440  const_iterator find(const KeyT& key) const
441  {
442  auto bucket = this->find_filled_bucket(key);
443  if (bucket == (size_t)-1)
444  {
445  return this->end();
446  }
447  return const_iterator(this, bucket);
448  }
449 
455  bool contains(const KeyT& k) const
456  {
457  return find_filled_bucket(k) != (size_t)-1;
458  }
459 
466  size_t count(const KeyT& k) const
467  {
468  return find_filled_bucket(k) != (size_t)-1 ? 1 : 0;
469  }
470 
476  ValueT* try_get(const KeyT& k)
477  {
478  auto bucket = find_filled_bucket(k);
479  if (bucket != (size_t)-1) {
480  return &_pairs[bucket].second;
481  } else {
482  return nullptr;
483  }
484  }
485 
491  const ValueT* try_get(const KeyT& k) const
492  {
493  auto bucket = find_filled_bucket(k);
494  if (bucket != (size_t)-1) {
495  return &_pairs[bucket].second;
496  } else {
497  return nullptr;
498  }
499  }
500 
501  // Convenience function.
502  const ValueT get_or_return_default(const KeyT& k) const
503  {
504  const ValueT* ret = try_get(k);
505  if (ret) {
506  return *ret;
507  } else {
508  return ValueT();
509  }
510  }
511 
512  // -----------------------------------------------------
513 
521  insert_iterator insert(const KeyT& key, const ValueT value)
522  {
523  check_expand_need();
524 
525  auto bucket = find_or_allocate(key);
526  bool didOverwrite;
527  if (_states[bucket] == State::FILLED) {
528  (_pairs + bucket)->second = value;
529  didOverwrite = true;
530  } else {
531  _states[bucket] = State::FILLED;
532  new(_pairs + bucket) PairT(key, value);
533  _num_filled++;
534  didOverwrite = false;
535  }
536 
537  return insert_iterator(this, bucket, didOverwrite);
538  }
539 
540  insert_iterator insert(const std::pair<KeyT, ValueT>& p)
541  {
542  return insert(p.first, p.second);
543  }
544 
552  {
553  for (; begin != end; ++begin) {
554  insert(begin->first, begin->second);
555  }
556  }
557 
566  void insert_unique(KeyT&& key, ValueT&& value)
567  {
568  agxAssert(!contains(key));
569  check_expand_need();
570  auto bucket = find_empty_bucket(key);
571  _states[bucket] = State::FILLED;
572  new(_pairs + bucket) PairT(std::move(key), std::move(value));
573  _num_filled++;
574  }
575 
576  void insert_unique(std::pair<KeyT, ValueT>&& p)
577  {
578  insert_unique(std::move(p.first), std::move(p.second));
579  }
580 
581  // Return the old value or ValueT() if it didn't exist.
582  ValueT set_get(const KeyT& key, const ValueT& new_value)
583  {
584  check_expand_need();
585 
586  auto bucket = find_or_allocate(key);
587 
588  // Check if inserting a new value rather than overwriting an old entry
589  if (_states[bucket] == State::FILLED) {
590  ValueT old_value = _pairs[bucket].second;
591  _pairs[bucket] = new_value.second;
592  return old_value;
593  } else {
594  _states[bucket] = State::FILLED;
595  new(_pairs + bucket) PairT(key, new_value);
596  _num_filled++;
597  return ValueT();
598  }
599  }
600 
608  ValueT& operator[](const KeyT& key)
609  {
610  check_expand_need();
611 
612  auto bucket = find_or_allocate(key);
613 
614  /* Check if inserting a new value rather than overwriting an old entry */
615  if (_states[bucket] != State::FILLED) {
616  _states[bucket] = State::FILLED;
617  new(_pairs + bucket) PairT(key, ValueT());
618  _num_filled++;
619  }
620 
621  return _pairs[bucket].second;
622  }
623 
624  // -------------------------------------------------------
625 
630  bool erase(const KeyT& key)
631  {
632  auto bucket = find_filled_bucket(key);
633  if (bucket != (size_t)-1) {
634  this->erase_bucket(bucket);
635  return true;
636  } else {
637  return false;
638  }
639  }
640 
646  {
647  agxAssert(it._map == this);
648  agxAssert(it._bucket < _num_buckets);
649  this->erase_bucket(it._bucket);
650  return ++it;
651  }
652 
656  void clear(int /*IGNORED_AGX_PARAMETER*/ = 0)
657  {
658  for (size_t bucket=0; bucket<_num_buckets; ++bucket) {
659  if (_states[bucket] == State::FILLED) {
660  _states[bucket] = State::INACTIVE;
661  _pairs[bucket].~PairT();
662  }
663  }
664  _num_filled = 0;
665  _max_probe_length = -1;
666  }
667 
671  void reserve(size_t num_elems)
672  {
673  size_t required_buckets = num_elems + num_elems/2 + 1;
674  if (required_buckets <= _num_buckets) {
675  return;
676  }
677  size_t num_buckets = 4;
678  while (num_buckets < required_buckets) { num_buckets *= 2; }
679 
680  auto new_states = (State*)_allocator.allocateBytes(num_buckets * sizeof(State));
681  auto new_pairs = (PairT*)_allocator.allocateBytes(num_buckets * sizeof(PairT));
682 
683  if (!new_states || !new_pairs) {
684  _allocator.deallocateBytes(new_states, num_buckets * sizeof(State));
685  _allocator.deallocateBytes(new_pairs, num_buckets * sizeof(PairT));
686  throw std::bad_alloc();
687  }
688 
689  //auto old_num_filled = _num_filled;
690  auto old_num_buckets = _num_buckets;
691  auto old_states = _states;
692  auto old_pairs = _pairs;
693 
694  _num_filled = 0;
695  _num_buckets = num_buckets;
696  _mask = _num_buckets - 1;
697  _states = new_states;
698  _pairs = new_pairs;
699 
700  std::fill_n(_states, num_buckets, State::INACTIVE);
701 
702  _max_probe_length = -1;
703 
704  for (size_t src_bucket=0; src_bucket<old_num_buckets; src_bucket++) {
705  if (old_states[src_bucket] == State::FILLED) {
706  auto& src_pair = old_pairs[src_bucket];
707 
708  auto dst_bucket = find_empty_bucket(src_pair.first);
709  agxAssert(dst_bucket != (size_t)-1);
710  agxAssert(_states[dst_bucket] != State::FILLED);
711  _states[dst_bucket] = State::FILLED;
712  new(_pairs + dst_bucket) PairT(std::move(src_pair));
713  _num_filled += 1;
714 
715  src_pair.~PairT();
716  }
717  }
718 
719  //agxAssert(old_num_filles == _num_filled);
720 
721  _allocator.deallocateBytes(old_states, old_num_buckets * sizeof(State));
722  _allocator.deallocateBytes(old_pairs, old_num_buckets * sizeof(PairT));
723  }
724 
725 
729  const void *ptr() const
730  {
731  return _pairs;
732  }
733 
734 protected:
735  // Find the bucket with this key, or return nullptr
736  template<typename T2>
737  size_t find_filled_bucket(const T2& key) const
738  {
739  if (empty()) { return (size_t)-1; } // Optimization
740 
741  auto hash_value = _hasher(key);
742  for (int offset=0; offset<=_max_probe_length; ++offset) {
743  auto bucket = (hash_value + offset) & _mask;
744  if (_states[bucket] == State::FILLED && agx::hashKeyEqual(_pairs[bucket].first, key)) {
745  return bucket;
746  }
747  if (_states[bucket] == State::INACTIVE) {
748  return (size_t)-1; // End of the chain!
749  }
750  }
751  return (size_t)-1;
752  }
753 
754  void erase_bucket(size_t bucket) {
755  _states[bucket] = State::ACTIVE;
756  _pairs[bucket].~PairT();
757  _num_filled -= 1;
758  }
759 
760 
761 private:
762  // Can we fit another element?
763  void check_expand_need()
764  {
765  reserve(_num_filled + 1);
766  }
767  // Find the bucket with this key, or return a good empty bucket to place the key in.
768  // In the latter case, the bucket is expected to be filled.
769  size_t find_or_allocate(const KeyT& key)
770  {
771  auto hash_value = _hasher(key);
772  size_t hole = (size_t)-1;
773  int offset=0;
774  for (; offset<=_max_probe_length; ++offset) {
775  auto bucket = (hash_value + offset) & _mask;
776 
777  if (_states[bucket] == State::FILLED) {
778  if (agx::hashKeyEqual(_pairs[bucket].first, key)) {
779  return bucket;
780  }
781  } else if (_states[bucket] == State::INACTIVE) {
782  return bucket;
783  } else {
784  // ACTIVE: keep searching
785  if (hole == (size_t)-1) {
786  hole = bucket;
787  }
788  }
789  }
790 
791  // No key found - but maybe a hole for it
792 
793  agxAssert(offset == _max_probe_length+1);
794 
795  if (hole != (size_t)-1) {
796  return hole;
797  }
798 
799  // No hole found within _max_probe_length
800  for (; ; ++offset) {
801  auto bucket = (hash_value + offset) & _mask;
802 
803  if (_states[bucket] != State::FILLED) {
804  _max_probe_length = offset;
805  return bucket;
806  }
807  }
808  }
809 
810  // key is not in this map. Find a place to put it.
811  size_t find_empty_bucket(const KeyT& key)
812  {
813  auto hash_value = _hasher(key);
814  for (int offset=0; ; ++offset) {
815  auto bucket = (hash_value + offset) & _mask;
816  if (_states[bucket] != State::FILLED) {
817  if (offset > _max_probe_length) {
818  _max_probe_length = offset;
819  }
820  return bucket;
821  }
822  }
823  }
824 
825 private:
826  HashT _hasher;
827  AllocatorT _allocator = AllocatorT();
828  State* _states = nullptr;
829  PairT* _pairs = nullptr;
830  size_t _num_buckets = 0;
831  size_t _num_filled = 0;
832  int _max_probe_length = -1; // Our longest bucket-brigade is this long. ONLY when we have zero elements is this ever negative (-1).
833  size_t _mask = 0; // _num_buckets minus one
834 };
835 
836 
837  template <typename KeyT, typename ValueT, typename HashT, typename AllocatorT>
839  {
840  return table.begin();
841  }
842 
843  template <typename KeyT, typename ValueT, typename HashT, typename AllocatorT>
845  {
846  return table.end();
847  }
848 
849 
850  template <typename KeyT, typename ValueT, typename HashT, typename AllocatorT>
852  {
853  return table.begin();
854  }
855 
856  template <typename KeyT, typename ValueT, typename HashT, typename AllocatorT>
858  {
859  return table.end();
860  }
861 
862 
870  template <typename KeyT, typename DataT, typename HashT = agx::HashFn<KeyT>, typename AllocatorT = ByteAllocator>
871  class LinearProbingHashTable : public LinearProbingHashTableImplementation<KeyT, DataT, HashT, AllocatorT>
872  {
873  public:
875 
877  {
878  }
879  };
880 
881 
882 
883  template <typename KeyT, typename DataT, typename HashT, typename AllocatorT>
884  class LinearProbingHashTable< agx::ref_ptr<KeyT>, DataT, HashT, AllocatorT> : public LinearProbingHashTableImplementation<agx::ref_ptr<KeyT>, DataT, HashT, AllocatorT>
885  {
886  public:
888  typedef typename Implementation::iterator iterator;
889  typedef typename Implementation::const_iterator const_iterator;
890 
892  {}
893 
895  bool contains(const KeyT *key) const
896  {
897  return this->find_filled_bucket(key) != (size_t)-1;
898  }
899 
900  using Implementation::find;
901  iterator find(const KeyT *key)
902  {
903  auto bucket = this->find_filled_bucket(key);
904  if (bucket == (size_t)-1) {
905  return this->end();
906  }
907  return iterator(this, bucket);
908  }
909 
910  const_iterator find(const KeyT *key) const
911  {
912  auto bucket = this->find_filled_bucket(key);
913  if (bucket == (size_t)-1) {
914  return this->end();
915  }
916  return const_iterator(this, bucket);
917  }
918 
919  using Implementation::erase;
920  bool erase(const KeyT *key)
921  {
922  auto bucket = this->find_filled_bucket(key);
923  if (bucket != (size_t)-1) {
924  this->erase_bucket(bucket);
925  return true;
926  } else {
927  return false;
928  }
929  }
930 
931  };
932 }
933 
934 #endif
const_iterator operator--(int)
Does not do any bounds checking, so only call this if there really is a previous element.
const_iterator operator--()
Does not do any bounds checking, so only call this if there really is a previous element.
insert_iterator(MyType *hash_map, size_t bucket, bool overwrite)
iterator operator--(int)
Does not do any bounds checking, so only call this if there really is a previous element.
iterator operator--()
Does not do any bounds checking, so only call this if there really is a previous element.
A cache-friendly hash table with open addressing, linear probing and power-of-two capacity.
iterator begin()
Iterator to first element in hash table.
bool contains(const KeyT &k) const
Check if the hash table contains a key/value pair for the given key.
void insert(const_iterator begin, const_iterator end)
Insert all elements in the given range.
iterator erase(iterator it)
Erase an element from the hash table.
const_iterator end() const
Iterator marking end of hash table.
iterator end()
Iterator marking end of hash table.
@ SHRINK_BUFFER_AVERAGED
Buffer is shrunk if a smoothing average (which is updated each clear call) goes below a threshold.
@ MAINTAIN_BUFFER
Buffer is maintained (normal stl behavior).
@ SHRINK_BUFFER
Buffer is deallocated and replaced by an newly allocated empty buffer.
bool erase(const KeyT &key)
Erase an element from the hash table.
LinearProbingHashTableImplementation & operator=(const LinearProbingHashTableImplementation &other)
const ValueT * try_get(const KeyT &k) const
Find the value associated with the given key.
ValueT & operator[](const KeyT &key)
Return the value associated with the given key.
void insert_unique(KeyT &&key, ValueT &&value)
Insert a key/value pair into the hash table assuming that the given key does not already exist in the...
void insert_unique(std::pair< KeyT, ValueT > &&p)
ValueT set_get(const KeyT &key, const ValueT &new_value)
const_iterator find(const KeyT &key) const
Find a key/value pair in the hash table given a key.
const ValueT get_or_return_default(const KeyT &k) const
void reserve(size_t num_elems)
Make room for this many elements in the hash table.
LinearProbingHashTableImplementation(LinearProbingHashTableImplementation &&other)
void swap(LinearProbingHashTableImplementation &other)
insert_iterator insert(const KeyT &key, const ValueT value)
Insert a key/value pair into the hash table.
iterator find(const KeyT &key)
Find a key/value pair in the hash table given a key.
void clear(int=0)
Remove all elements, keeping full capacity.
ValueT * try_get(const KeyT &k)
Find the value associated with the given key.
LinearProbingHashTableImplementation & operator=(LinearProbingHashTableImplementation &&other)
insert_iterator insert(const std::pair< KeyT, ValueT > &p)
const_iterator begin() const
Iterator to first element in hash table.
size_t count(const KeyT &k) const
Count the number of key/value pairs matching the given key.
LinearProbingHashTableImplementation(const LinearProbingHashTableImplementation &other)
LinearProbingHashTableImplementation< agx::ref_ptr< KeyT >, DataT, HashT, AllocatorT > Implementation
Inheritance with partial specialization due to bug with ref_ptr containers.
LinearProbingHashTableImplementation< KeyT, DataT, HashT, AllocatorT > Implementation
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
#define agxAssert(expr)
Definition: debug.h:143
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
LinearProbingHashSetImplementation< KeyT, HashT >::const_iterator cend(const LinearProbingHashSetImplementation< KeyT, HashT > &set)
bool hashKeyEqual(const T1 &key1, const T2 &key2)
Definition: HashFunction.h:77
LinearProbingHashSetImplementation< KeyT, HashT >::const_iterator cbegin(const LinearProbingHashSetImplementation< KeyT, HashT > &set)