|
| | NCollection_FlatDataMap () |
| | Default constructor.
|
| |
| | NCollection_FlatDataMap (const size_t theNbBuckets) |
| | Constructor with initial capacity hint.
|
| |
| | NCollection_FlatDataMap (const Hasher &theHasher, const size_t theNbBuckets=0) |
| | Constructor with custom hasher (copy).
|
| |
| | NCollection_FlatDataMap (Hasher &&theHasher, const size_t theNbBuckets=0) |
| | Constructor with custom hasher (move).
|
| |
| | NCollection_FlatDataMap (const NCollection_FlatDataMap &theOther) |
| | Copy constructor.
|
| |
| | NCollection_FlatDataMap (NCollection_FlatDataMap &&theOther) noexcept |
| | Move constructor.
|
| |
| | ~NCollection_FlatDataMap () |
| | Destructor.
|
| |
| NCollection_FlatDataMap & | operator= (const NCollection_FlatDataMap &theOther) |
| | Copy assignment.
|
| |
| NCollection_FlatDataMap & | operator= (NCollection_FlatDataMap &&theOther) noexcept |
| | Move assignment.
|
| |
| size_t | Size () const noexcept |
| | Returns number of elements.
|
| |
| int | Extent () const noexcept |
| | Returns number of elements (legacy int-returning API, convention shared with BaseMap).
|
| |
| bool | IsEmpty () const noexcept |
| | Returns true if map is empty.
|
| |
| size_t | Capacity () const noexcept |
| | Returns current capacity.
|
| |
| bool | IsBound (const TheKeyType &theKey) const |
| | Check if key exists.
|
| |
| std::optional< std::pair< std::reference_wrapper< const TheKeyType >, std::reference_wrapper< const TheItemType > > > | Contained (const TheKeyType &theKey) const |
| | Contained returns optional pair of const references to key and value. Returns std::nullopt if the key is not found.
|
| |
| std::optional< std::pair< std::reference_wrapper< const TheKeyType >, std::reference_wrapper< TheItemType > > > | Contained (const TheKeyType &theKey) |
| | Contained returns optional pair of const key reference and mutable value reference. Returns std::nullopt if the key is not found.
|
| |
| const TheItemType * | Seek (const TheKeyType &theKey) const |
| | Find value by key, returns nullptr if not found.
|
| |
| TheItemType * | ChangeSeek (const TheKeyType &theKey) |
| | Find value by key (mutable), returns nullptr if not found.
|
| |
| const TheItemType & | Find (const TheKeyType &theKey) const |
| | Find value by key, throws if not found.
|
| |
| TheItemType & | ChangeFind (const TheKeyType &theKey) |
| | Find value by key (mutable), throws if not found.
|
| |
| const TheItemType & | operator() (const TheKeyType &theKey) const |
| | Operator() for const access.
|
| |
| TheItemType & | operator() (const TheKeyType &theKey) |
| | Operator() for mutable access.
|
| |
| bool | Bind (const TheKeyType &theKey, const TheItemType &theItem) |
| | Bind key to value.
|
| |
| bool | Bind (const TheKeyType &theKey, TheItemType &&theItem) |
| | Bind key to value (move semantics for value)
|
| |
| bool | Bind (TheKeyType &&theKey, const TheItemType &theItem) |
| | Bind key to value (move semantics for key)
|
| |
| bool | Bind (TheKeyType &&theKey, TheItemType &&theItem) |
| | Bind key to value (move semantics for both)
|
| |
| bool | TryBind (const TheKeyType &theKey, const TheItemType &theItem) |
| | TryBind binds key to value only if key is not yet bound.
|
| |
| bool | TryBind (const TheKeyType &theKey, TheItemType &&theItem) |
| | TryBind binds key to value only if key is not yet bound.
|
| |
| bool | TryBind (TheKeyType &&theKey, const TheItemType &theItem) |
| | TryBind binds key to value only if key is not yet bound.
|
| |
| bool | TryBind (TheKeyType &&theKey, TheItemType &&theItem) |
| | TryBind binds key to value only if key is not yet bound.
|
| |
| TheItemType & | Bound (const TheKeyType &theKey, const TheItemType &theItem) |
| | Bound binds key to value and returns reference to the value.
|
| |
| TheItemType & | Bound (const TheKeyType &theKey, TheItemType &&theItem) |
| | Bound binds key to value and returns reference to the value.
|
| |
| TheItemType & | Bound (TheKeyType &&theKey, const TheItemType &theItem) |
| | Bound binds key to value and returns reference to the value.
|
| |
| TheItemType & | Bound (TheKeyType &&theKey, TheItemType &&theItem) |
| | Bound binds key to value and returns reference to the value.
|
| |
| TheItemType & | TryBound (const TheKeyType &theKey, const TheItemType &theItem) |
| | TryBound binds key to value only if key is not yet bound.
|
| |
| TheItemType & | TryBound (const TheKeyType &theKey, TheItemType &&theItem) |
| | TryBound binds key to value only if key is not yet bound.
|
| |
| TheItemType & | TryBound (TheKeyType &&theKey, const TheItemType &theItem) |
| | TryBound binds key to value only if key is not yet bound.
|
| |
| TheItemType & | TryBound (TheKeyType &&theKey, TheItemType &&theItem) |
| | TryBound binds key to value only if key is not yet bound.
|
| |
| template<typename K , typename... Args> |
| bool | Emplace (K &&theKey, Args &&... theArgs) |
| | Emplace constructs value in-place; if key exists, updates the value.
|
| |
| template<typename K , typename... Args> |
| TheItemType & | Emplaced (K &&theKey, Args &&... theArgs) |
| | Emplaced constructs value in-place; if key exists, updates the value.
|
| |
| template<typename K , typename... Args> |
| bool | TryEmplace (K &&theKey, Args &&... theArgs) |
| | TryEmplace constructs value in-place only if key not already bound.
|
| |
| template<typename K , typename... Args> |
| TheItemType & | TryEmplaced (K &&theKey, Args &&... theArgs) |
| | TryEmplaced constructs value in-place only if key not already bound.
|
| |
| bool | UnBind (const TheKeyType &theKey) |
| | Remove key from map.
|
| |
| void | Clear (bool doReleaseMemory=false) |
| | Clear all elements.
|
| |
| void | Exchange (NCollection_FlatDataMap &theOther) noexcept |
| | Exchange content with another map.
|
| |
| const Hasher & | GetHasher () const noexcept |
| | Returns const reference to the hasher.
|
| |
| void | reserve (size_t theN) |
| | Reserve capacity for at least theN elements.
|
| |
| Iterator | begin () const noexcept |
| | Returns iterator to first element.
|
| |
| Iterator | end () const noexcept |
| | Returns iterator past the end.
|
| |
| Iterator | cbegin () const noexcept |
| | Returns iterator to first element.
|
| |
| Iterator | cend () const noexcept |
| | Returns iterator past the end.
|
| |
| ItemsView | Items () |
| | Returns a view for key-value pair iteration. Usage: for (auto [aKey, aValue] : aMap.Items())
|
| |
| ConstItemsView | Items () const |
| | Returns a const view for key-value pair iteration. Usage: for (const auto& [aKey, aValue] : aMap.Items())
|
| |
High-performance hash map using open addressing with Robin Hood hashing.
NCollection_FlatDataMap is an alternative to NCollection_DataMap that provides better cache locality and reduced memory allocation overhead by storing all key-value pairs inline in a contiguous array.
Key features:
- Open addressing with linear probing (better cache locality)
- Robin Hood hashing (reduces probe sequence variance)
- Power-of-2 sizing for fast modulo operations
- No per-element allocations
Typical faster usage patterns:
- POD or small key/value types
- Performance-critical code paths
- Lookup-heavy workloads
- Full traversal / iteration-heavy workloads
- Stable-size maps with Reserve() called once before bulk Bind()
Container-specific implementation notes:
- UnBind() keeps probe clusters consistent using backward-shift compaction.
Relative to NCollection_DataMap:
- Bind()/UnBind() can be faster in many workloads thanks to contiguous storage and no per-element node allocation.
- Iteration is often faster due to contiguous slot scanning and reduced pointer chasing.
Limitations:
- Keys and values must be movable
- Higher memory usage at low load factors
- Iteration order is not insertion order
- Probe distance grows with collisions (bounded by table capacity)
- Note
- This class is NOT thread-safe. External synchronization is required for concurrent access from multiple threads.
- Template Parameters
-