|
| iterator | begin () const noexcept |
| | Returns an iterator pointing to the first element in the map.
|
| |
| iterator | end () const noexcept |
| | Returns an iterator referring to the past-the-end element in the map.
|
| |
| const_iterator | cbegin () const noexcept |
| | Returns a const iterator pointing to the first element in the map.
|
| |
| const_iterator | cend () const noexcept |
| | Returns a const iterator referring to the past-the-end element in the map.
|
| |
| IndexedItemsView | IndexedItems () const |
| | Returns a view for key-index pair iteration. Usage: for (auto [aKey, anIndex] : aMap.IndexedItems())
|
| |
| | NCollection_IndexedMap () |
| | Empty constructor.
|
| |
| | NCollection_IndexedMap (const size_t theNbBuckets, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr) |
| | Constructor.
|
| |
| | NCollection_IndexedMap (const int theNbBuckets, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr) |
| | Constructor (legacy int-taking).
|
| |
| | NCollection_IndexedMap (const Hasher &theHasher, const size_t theNbBuckets=1, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr) |
| | Constructor with custom hasher (copy).
|
| |
| | NCollection_IndexedMap (const Hasher &theHasher, const int theNbBuckets, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr) |
| | Constructor with custom hasher (copy, legacy int-taking).
|
| |
| | NCollection_IndexedMap (Hasher &&theHasher, const size_t theNbBuckets=1, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr) |
| | Constructor with custom hasher (move).
|
| |
| | NCollection_IndexedMap (Hasher &&theHasher, const int theNbBuckets, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr) |
| | Constructor with custom hasher (move, legacy int-taking).
|
| |
| | NCollection_IndexedMap (const NCollection_IndexedMap &theOther) |
| | Copy constructor.
|
| |
| | NCollection_IndexedMap (NCollection_IndexedMap &&theOther) noexcept |
| | Move constructor.
|
| |
| void | Exchange (NCollection_IndexedMap &theOther) noexcept |
| | Exchange the content of two maps without re-allocations. Notice that allocators will be swapped as well!
|
| |
| const Hasher & | GetHasher () const noexcept |
| | Returns const reference to the hasher.
|
| |
| NCollection_IndexedMap & | Assign (const NCollection_IndexedMap &theOther) |
| | Assign. This method does not change the internal allocator.
|
| |
| NCollection_IndexedMap & | operator= (const NCollection_IndexedMap &theOther) |
| | Assignment operator.
|
| |
| NCollection_IndexedMap & | operator= (NCollection_IndexedMap &&theOther) noexcept |
| | Move operator.
|
| |
| void | ReSize (const size_t theExtent) |
| | ReSize.
|
| |
| void | ReSize (const int theExtent) |
| |
| int | Add (const TheKeyType &theKey1) |
| | Add adds a new key to the map.
|
| |
| int | Add (TheKeyType &&theKey1) |
| | Add adds a new key to the map.
|
| |
| const TheKeyType & | Added (const TheKeyType &theKey1) |
| | Added: add a new key if not yet in the map, and return reference to either newly added or previously existing key.
|
| |
| const TheKeyType & | Added (TheKeyType &&theKey1) |
| | Added: add a new key if not yet in the map, and return reference to either newly added or previously existing key.
|
| |
| template<typename... Args> |
| int | Emplace (Args &&... theArgs) |
| | Emplace constructs key in-place; if key exists, destroys and reconstructs.
|
| |
| template<typename... Args> |
| const TheKeyType & | Emplaced (Args &&... theArgs) |
| | Emplaced constructs key in-place; if key exists, overwrites.
|
| |
| template<typename... Args> |
| int | TryEmplace (Args &&... theArgs) |
| | TryEmplace constructs key in-place only if not already present.
|
| |
| template<typename... Args> |
| const TheKeyType & | TryEmplaced (Args &&... theArgs) |
| | TryEmplaced constructs key in-place only if not already present.
|
| |
| bool | Contains (const TheKeyType &theKey1) const |
| | Contains.
|
| |
| std::optional< std::reference_wrapper< const TheKeyType > > | Contained (const TheKeyType &theKey1) const |
| | Contained returns optional const reference to the key in the map. Returns std::nullopt if the key is not found.
|
| |
| void | Substitute (const size_t theIndex, const TheKeyType &theKey1) |
| | Substitute.
|
| |
| void | Substitute (const int theIndex, const TheKeyType &theKey1) |
| |
| void | Swap (const size_t theIndex1, const size_t theIndex2) |
| | Swaps two elements with the given indices.
|
| |
| void | Swap (const int theIndex1, const int theIndex2) |
| |
| void | RemoveLast () |
| | RemoveLast.
|
| |
| void | RemoveFromIndex (const size_t theIndex) |
| | Remove the key of the given index. Caution! The index of the last key can be changed.
|
| |
| void | RemoveFromIndex (const int theIndex) |
| |
| bool | RemoveKey (const TheKeyType &theKey1) |
| | Remove the given key. Caution! The index of the last key can be changed.
|
| |
| const TheKeyType & | FindKey (const size_t theIndex) const |
| | FindKey.
|
| |
| const TheKeyType & | FindKey (const int theIndex) const |
| |
| const TheKeyType & | operator() (const size_t theIndex) const |
| | operator ()
|
| |
| const TheKeyType & | operator() (const int theIndex) const |
| |
| int | FindIndex (const TheKeyType &theKey1) const |
| | FindIndex.
|
| |
| void | Clear (const bool doReleaseMemory=false) |
| | Clear data. If doReleaseMemory is false then the table of buckets is not released and will be reused.
|
| |
| void | Clear (const occ::handle< NCollection_BaseAllocator > &theAllocator) |
| | Clear data and reset allocator.
|
| |
| | ~NCollection_IndexedMap () override |
| | Destructor.
|
| |
| size_t | NbBuckets () const noexcept |
| | NbBuckets.
|
| |
| int | Extent () const noexcept |
| | Extent (number of elements, legacy int-returning API).
|
| |
| int | Length () const noexcept |
| | Length - number of elements (legacy int-returning API, synonym of Extent()).
|
| |
| size_t | Size () const noexcept |
| | Size - number of elements.
|
| |
| bool | IsEmpty () const noexcept |
| | IsEmpty.
|
| |
| const occ::handle< NCollection_BaseAllocator > & | Allocator () const noexcept |
| | Returns attached allocator.
|
| |
|
| bool | lookup (const TheKeyType &theKey, IndexedMapNode *&theNode, size_t &theHash) const |
| | Lookup for particular key in map.
|
| |
| bool | lookup (const TheKeyType &theKey, IndexedMapNode *&theNode) const |
| | Lookup for particular key in map.
|
| |
| bool | IsEqual (const TheKeyType &theKey1, const TheKeyType &theKey2) const |
| |
| size_t | HashCode (const TheKeyType &theKey, const size_t theUpperBound) const |
| |
| template<typename K , bool ReturnRef> |
| auto | addImpl (K &&theKey1, std::bool_constant< ReturnRef >) -> std::conditional_t< ReturnRef, const TheKeyType &, int > |
| | Implementation helper for Add/Added (uses TryEmplace behavior - no modification on existing).
|
| |
| template<bool IsTry, bool ReturnRef, typename... Args> |
| auto | emplaceImpl (std::bool_constant< IsTry >, std::bool_constant< ReturnRef >, Args &&... theArgs) -> std::conditional_t< ReturnRef, const TheKeyType &, int > |
| | Implementation helper for Emplace/Emplaced.
|
| |
| | NCollection_BaseMap (const size_t theNbBuckets, const bool single, const occ::handle< NCollection_BaseAllocator > &theAllocator) |
| | Constructor.
|
| |
| | NCollection_BaseMap (NCollection_BaseMap &&theOther) noexcept |
| | Move Constructor.
|
| |
| virtual | ~NCollection_BaseMap ()=default |
| | Destructor.
|
| |
| bool | BeginResize (const size_t theExtent, size_t &theNewBuckets, NCollection_ListNode **&data1, NCollection_ListNode **&data2) const |
| | BeginResize.
|
| |
| void | EndResize (const size_t theExtent, const size_t theNewBuckets, NCollection_ListNode **data1, NCollection_ListNode **data2) noexcept |
| | EndResize.
|
| |
| bool | Resizable () const noexcept |
| | Resizable.
|
| |
| size_t | Increment () noexcept |
| | Increment.
|
| |
| size_t | Decrement () noexcept |
| | Decrement.
|
| |
| void | Destroy (NCollection_DelMapNode fDel, bool doReleaseMemory=true) |
| | Destroy.
|
| |
| size_t | NextPrimeForMap (const size_t N) const noexcept |
| | NextPrimeForMap.
|
| |
| void | exchangeMapsData (NCollection_BaseMap &theOther) noexcept |
| | Exchange content of two maps without data copying.
|
| |
| NCollection_BaseMap & | operator= (NCollection_BaseMap &&) noexcept=delete |
| | Move operator.
|
| |
| | NCollection_BaseMap (const NCollection_BaseMap &)=delete |
| | Copy Constructor.
|
| |
| NCollection_BaseMap & | operator= (const NCollection_BaseMap &)=delete |
| | Assign operator.
|
| |
template<
class TheKeyType,
class Hasher = NCollection_DefaultHasher<TheKeyType>>
class NCollection_IndexedMap< TheKeyType, Hasher >
Purpose: An indexed map is used to store keys and to bind an index to them. Each new key stored in the map gets an index. Index are incremented as keys are stored in the map. A key can be found by the index and an index by the key. No key but the last can be removed so the indices are in the range 1..Extent. See the class Map from NCollection for a discussion about the number of buckets.