template<typename K, typename V, Int GROUP_BITS = 4, Int BUCKET_SIZE = 16, BURSTTRIE_SORT SORT = BURSTTRIE_SORT::LINEAR_SEARCH, template< typename, typename > class POOL = PointerBurstTriePool>
class maxon::BurstTrieMap< K, V, GROUP_BITS, BUCKET_SIZE, SORT, POOL >
A BurstTrieMap maps unsigned integral keys to values using three levels:
- At first, keys are divided based on their number of leading zero bits.
- Then, a tree is traversed using groups of GROUP_BITS bits as indices into child nodes.
- Finally, a leaf node contains a small array-map-like map of at most BUCKET_SIZE entries. When a full leaf node (BUCKET_SIZE entries) needs to get a further entry, it is split into an inner node with children. Likewise, if after erasure an inner node has less than two-thirds of BUCKET_SIZE key-value-pairs in its descendants, those pairs will be combined to a single leaf node which then replaces the inner node and its descendants.
Performance characteristics: Like an ArrayMap, a BurstTrieMap allows an iteration in the order of the keys. But it performs much better than an ArrayMap when the number of entries gets large (say, more than 100): The number of inner nodes to visit is bounded by the maximum bit length of a key, so operations like insertion, erasure or searching are bounded by a constant time cost, too: O(1).
See HashMap for more examples on how to use maps in general.
- Template Parameters
- 
  
    | K | Type of keys. This must be an unsigned integral type. |  | V | Type of values. |  | GROUP_BITS | Number of bits which shall be grouped to form an index into the children array of an inner node. This shouldn't exceed 4. |  | BUCKET_SIZE | Maximum size of a bucket of a leaf node. Reasonable values are between 4 and 40. |  | SORT | Mode for sorting of the buckets. |  | POOL | Memory pool for the nodes. |  
 
- See also
- $ref maps 
|  | 
| using | IsBurstTrieMap = std::true_type | 
|  | 
| using | Bucket = BurstTrieBucket< K, V, BUCKET_SIZE > | 
|  | 
| using | Node = BurstTrieNode< GROUP_BITS, typename POOL< Int, Int >::Index > | 
|  | 
| using | Pool = POOL< Node, Bucket > | 
|  | 
| using | Index = typename Pool::Index | 
|  | 
| using | Super = MapBase< BurstTrieMap< K, V, GROUP_BITS, BUCKET_SIZE, SORT, POOL >, K, V, Pool, DefaultCompare > | 
|  | 
| using | Iterator = IteratorTemplate< false, EntryIteratorBase > | 
|  | 
| using | ConstIterator = IteratorTemplate< true, EntryIteratorBase > | 
|  | 
| using | KeyIterator = IteratorTemplate< false, KeyIteratorBase > | 
|  | 
| using | ConstKeyIterator = IteratorTemplate< true, KeyIteratorBase > | 
|  | 
| using | ValueIterator = IteratorTemplate< false, ValueIteratorBase > | 
|  | 
| using | ConstValueIterator = IteratorTemplate< true, ValueIteratorBase > | 
|  | 
| using | MapType = COLLECTION | 
|  | 
| using | Super = BaseCollection< COLLECTION, SUPER > | 
|  | 
| using | KeyType = KEYTYPE | 
|  | 
| using | ValueType = VALUETYPE | 
|  | 
| using | IsCollection = std::true_type | 
|  | 
| using | IsBaseArray = std::false_type | 
|  | 
|  | 
|  | BurstTrieMap () | 
|  | 
|  | BurstTrieMap (Pool &&a) | 
|  | 
|  | BurstTrieMap (const Pool &a) | 
|  | 
|  | BurstTrieMap (BurstTrieMap &&src) | 
|  | 
|  | MAXON_OPERATOR_MOVE_ASSIGNMENT (BurstTrieMap) | 
|  | 
|  | ~BurstTrieMap () | 
|  | 
| template<typename MAP > | 
| SFINAEHelper< Result< void >, typename std::remove_reference< MAP >::type::IsBurstTrieMap >::type | CopyFromImpl (MAP &&src, COLLECTION_RESIZE_FLAGS resizeFlags, OverloadRank1) | 
|  | 
| void | Reset () | 
|  | 
| void | Flush () | 
|  | 
| ResultMem | SetCapacityHint (Int, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) | 
|  | 
| Int | GetCount () const | 
|  | 
| Int | GetOperationCountForSearch () const | 
|  | 
| Int | GetDepth () const | 
|  | 
| Int | GetMemorySize () const | 
|  | 
| Iterator | Begin () | 
|  | 
| Iterator | End () | 
|  | 
| ConstIterator | Begin () const | 
|  | 
| ConstIterator | End () const | 
|  | 
| KeyIterator | GetKeys () | 
|  | 
| ConstKeyIterator | GetKeys () const | 
|  | 
| ValueIterator | GetValues () | 
|  | 
| ConstValueIterator | GetValues () const | 
|  | 
| ResultMemT< Iterator > | InsertEntry (K key, Bool &created=BoolLValue()) | 
|  | 
| ResultMemT< Iterator > | Insert (K key, const V &value, Bool &created=BoolLValue()) | 
|  | 
| ResultMemT< Iterator > | Insert (K key, V &&value, Bool &created=BoolLValue()) | 
|  | 
| ResultRef< V > | InsertKey (K key, Bool &created=BoolLValue()) | 
|  | 
| const V * | FindValue (K key) const | 
|  | 
| V * | FindValue (K key) | 
|  | 
| Iterator | Find (K key) | 
|  | 
| ConstIterator | Find (K key) const | 
|  | 
| Iterator | FindFloor (K key) | 
|  | 
| ConstIterator | FindFloor (K key) const | 
|  | 
| ResultOk< Bool > | Erase (K key) | 
|  | 
| template<template< Bool > class SUPER> | 
| IteratorTemplate< false, SUPER > | Erase (const IteratorTemplate< false, SUPER > &position, Int eraseCnt=1) | 
|  | 
| MAXON_ATTRIBUTE_FORCE_INLINE | MapBase (ARGS &&... args) | 
|  | 
| MapImpl< BurstTrieMap< K, V, 4, 16, BURSTTRIE_SORT::LINEAR_SEARCH, PointerBurstTriePool > & > | ToMap () | 
|  | 
| MapImpl< const BurstTrieMap< K, V, 4, 16, BURSTTRIE_SORT::LINEAR_SEARCH, PointerBurstTriePool > & > | ToMap () const | 
|  | 
| MAXON_ATTRIBUTE_FORCE_INLINE | operator MapImpl< BurstTrieMap< K, V, 4, 16, BURSTTRIE_SORT::LINEAR_SEARCH, PointerBurstTriePool > & > () | 
|  | 
| MAXON_ATTRIBUTE_FORCE_INLINE | operator MapImpl< const BurstTrieMap< K, V, 4, 16, BURSTTRIE_SORT::LINEAR_SEARCH, PointerBurstTriePool > & > () const | 
|  | 
| template<typename... ARGS> | 
| MAXON_ATTRIBUTE_FORCE_INLINE | MapBase0 (ARGS &&... args) | 
|  | 
| MAXON_ATTRIBUTE_FORCE_INLINE Bool | Contains (typename ByValueParam< KEYTYPE >::type key) const | 
|  | 
| template<typename PAIR > | 
| MAXON_ATTRIBUTE_FORCE_INLINE SFINAEHelper< Bool, typename PAIR::KeyType >::type | Contains (const PAIR &pair) const | 
|  | 
| ResultRef< VALUETYPE > | Append (const KEYTYPE &key) | 
|  | 
| template<typename PAIR > | 
| SFINAEHelper< ResultRef< VALUETYPE >, typename PAIR::KeyType >::type | Append (const PAIR &pair) | 
|  | 
| template<typename COLLECTION2 > | 
| Result< void > | Add (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) | 
|  | 
| template<typename COLLECTION2 > | 
| Result< void > | AppendAll (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) | 
|  | 
| template<typename COLLECTION2 > | 
| Result< void > | AppendAllInverse (COLLECTION2 &&other) | 
|  | 
| template<typename COLLECTION2 > | 
| Bool | ContainsAllImpl (COLLECTION2 &&other, OverloadRank0) const | 
|  | 
| template<typename COLLECTION2 > | 
| Result< void > | SubtractImpl (COLLECTION2 &&other, OverloadRank0) | 
|  | 
| template<typename COLLECTION2 , typename COMPARE > | 
| Bool | IsEqualImpl (const COLLECTION2 &other, COMPARE &&cmp, OverloadRank0) const | 
|  | 
| HashInt | GetHashCode () const | 
|  | 
| UniqueHash | GetUniqueHashCode () const | 
|  | 
| template<typename... ARGS> | 
| MAXON_ATTRIBUTE_FORCE_INLINE | BaseCollection (ARGS &&... args) | 
|  | 
| template<typename COLLECTION2 > | 
| MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value, Bool >::type | operator== (const COLLECTION2 &other) const | 
|  | 
| template<typename COLLECTION2 > | 
| MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value, Bool >::type | operator!= (const COLLECTION2 &other) const | 
|  | 
| template<typename COMPARE  = EqualityCompare, typename COLLECTION2 > | 
| MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value &&!STD_IS_REPLACEMENT(same, typename std::decay< COMPARE >::type, EQUALITY), Bool >::type | IsEqual (const COLLECTION2 &other, COMPARE &&cmp=COMPARE()) const | 
|  | 
| template<typename COLLECTION2 > | 
| MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | AppendAll (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) | 
|  | 
| template<typename COLLECTION2 > | 
| MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | CopyFrom (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::FIT_TO_SIZE) | 
|  | 
| template<typename COLLECTION2 > | 
| MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | Subtract (COLLECTION2 &&other) | 
|  | 
| template<typename COLLECTION2 > | 
| MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | Intersect (const COLLECTION2 &other) | 
|  | 
| template<typename COLLECTION2 > | 
| Bool | Intersects (const COLLECTION2 &other) const | 
|  | 
| template<typename COLLECTION2 > | 
| MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | CopyFromImpl (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags, OverloadRank0) | 
|  | 
| template<typename COLLECTION2 > | 
| Result< void > | AppendAllImpl (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags, Bool overwrite, OverloadRank0) | 
|  | 
| template<typename COLLECTION2 > | 
| Result< void > | IntersectImpl (COLLECTION2 &&other, OverloadRank0) | 
|  | 
| MAXON_ATTRIBUTE_FORCE_INLINE Bool | IsEmpty () const | 
|  | 
| MAXON_ATTRIBUTE_FORCE_INLINE Bool | IsPopulated () const | 
|  | 
| String | ToString (const FormatStatement *formatStatement=nullptr) const | 
|  | 
| template<typename COLLECTION2 > | 
| MAXON_ATTRIBUTE_FORCE_INLINE Bool | ContainsAll (COLLECTION2 &&other) const | 
|  | 
| template<typename COLLECTION2 > | 
| Bool | ContainsAllImpl (COLLECTION2 &&other, OverloadRank0) const | 
|  |