Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions
NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher > Class Template Reference

High-performance hash map using open addressing with Robin Hood hashing. More...

#include <NCollection_FlatDataMap.hxx>

Data Structures

class  Iterator
 Forward iterator for NCollection_FlatDataMap. More...
 

Public Types

using key_type = TheKeyType
 STL-compliant type alias for key type.
 
using value_type = TheItemType
 STL-compliant type alias for value type.
 
using KeyValueRef = NCollection_ItemsView::KeyValueRef<TheKeyType, TheItemType, false>
 Key-value pair reference for structured binding support. Enables: for (auto [key, value] : map.Items())
 
using ConstKeyValueRef = NCollection_ItemsView::KeyValueRef<TheKeyType, TheItemType, true>
 Const key-value pair reference for structured binding support.
 
using ItemsView
 View class for key-value pair iteration (mutable).
 
using ConstItemsView
 View class for key-value pair iteration (const).
 

Public Member Functions

 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_FlatDataMapoperator= (const NCollection_FlatDataMap &theOther)
 Copy assignment.
 
NCollection_FlatDataMapoperator= (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 TheItemTypeSeek (const TheKeyType &theKey) const
 Find value by key, returns nullptr if not found.
 
TheItemTypeChangeSeek (const TheKeyType &theKey)
 Find value by key (mutable), returns nullptr if not found.
 
const TheItemTypeFind (const TheKeyType &theKey) const
 Find value by key, throws if not found.
 
TheItemTypeChangeFind (const TheKeyType &theKey)
 Find value by key (mutable), throws if not found.
 
const TheItemTypeoperator() (const TheKeyType &theKey) const
 Operator() for const access.
 
TheItemTypeoperator() (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.
 
TheItemTypeBound (const TheKeyType &theKey, const TheItemType &theItem)
 Bound binds key to value and returns reference to the value.
 
TheItemTypeBound (const TheKeyType &theKey, TheItemType &&theItem)
 Bound binds key to value and returns reference to the value.
 
TheItemTypeBound (TheKeyType &&theKey, const TheItemType &theItem)
 Bound binds key to value and returns reference to the value.
 
TheItemTypeBound (TheKeyType &&theKey, TheItemType &&theItem)
 Bound binds key to value and returns reference to the value.
 
TheItemTypeTryBound (const TheKeyType &theKey, const TheItemType &theItem)
 TryBound binds key to value only if key is not yet bound.
 
TheItemTypeTryBound (const TheKeyType &theKey, TheItemType &&theItem)
 TryBound binds key to value only if key is not yet bound.
 
TheItemTypeTryBound (TheKeyType &&theKey, const TheItemType &theItem)
 TryBound binds key to value only if key is not yet bound.
 
TheItemTypeTryBound (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>
TheItemTypeEmplaced (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>
TheItemTypeTryEmplaced (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())
 

Detailed Description

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
class NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >

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:

Typical faster usage patterns:

Container-specific implementation notes:

Relative to NCollection_DataMap:

Limitations:

Note
This class is NOT thread-safe. External synchronization is required for concurrent access from multiple threads.
Template Parameters
TheKeyTypeType of keys
TheItemTypeType of values
HasherHash and equality functor (default: NCollection_DefaultHasher)

Member Typedef Documentation

◆ ConstItemsView

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
using NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::ConstItemsView
Initial value:
NCollection_ItemsView::
View<NCollection_FlatDataMap, ConstKeyValueRef, ConstItemsExtractor, true>

View class for key-value pair iteration (const).

◆ ConstKeyValueRef

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
using NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::ConstKeyValueRef = NCollection_ItemsView::KeyValueRef<TheKeyType, TheItemType, true>

Const key-value pair reference for structured binding support.

◆ ItemsView

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
using NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::ItemsView
Initial value:
Generic view class for Items() iteration.
Definition NCollection_ItemsView.hxx:174

View class for key-value pair iteration (mutable).

◆ key_type

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
using NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::key_type = TheKeyType

STL-compliant type alias for key type.

◆ KeyValueRef

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
using NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::KeyValueRef = NCollection_ItemsView::KeyValueRef<TheKeyType, TheItemType, false>

Key-value pair reference for structured binding support. Enables: for (auto [key, value] : map.Items())

◆ value_type

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
using NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::value_type = TheItemType

STL-compliant type alias for value type.

Constructor & Destructor Documentation

◆ NCollection_FlatDataMap() [1/6]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::NCollection_FlatDataMap ( )
inline

Default constructor.

◆ NCollection_FlatDataMap() [2/6]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::NCollection_FlatDataMap ( const size_t theNbBuckets)
inlineexplicit

Constructor with initial capacity hint.

Parameters
theNbBucketsinitial capacity (will be rounded up to power of 2)

◆ NCollection_FlatDataMap() [3/6]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::NCollection_FlatDataMap ( const Hasher & theHasher,
const size_t theNbBuckets = 0 )
inlineexplicit

Constructor with custom hasher (copy).

Parameters
theHashercustom hasher instance
theNbBucketsinitial capacity hint

◆ NCollection_FlatDataMap() [4/6]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::NCollection_FlatDataMap ( Hasher && theHasher,
const size_t theNbBuckets = 0 )
inlineexplicit

Constructor with custom hasher (move).

Parameters
theHashercustom hasher instance (moved)
theNbBucketsinitial capacity hint

◆ NCollection_FlatDataMap() [5/6]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::NCollection_FlatDataMap ( const NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher > & theOther)
inline

Copy constructor.

◆ NCollection_FlatDataMap() [6/6]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::NCollection_FlatDataMap ( NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher > && theOther)
inlinenoexcept

Move constructor.

◆ ~NCollection_FlatDataMap()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::~NCollection_FlatDataMap ( )
inline

Destructor.

Member Function Documentation

◆ begin()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
Iterator NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::begin ( ) const
inlinenoexcept

Returns iterator to first element.

◆ Bind() [1/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Bind ( const TheKeyType & theKey,
const TheItemType & theItem )
inline

Bind key to value.

Returns
true if key was newly added, false if existing key was updated

◆ Bind() [2/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Bind ( const TheKeyType & theKey,
TheItemType && theItem )
inline

Bind key to value (move semantics for value)

◆ Bind() [3/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Bind ( TheKeyType && theKey,
const TheItemType & theItem )
inline

Bind key to value (move semantics for key)

◆ Bind() [4/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Bind ( TheKeyType && theKey,
TheItemType && theItem )
inline

Bind key to value (move semantics for both)

◆ Bound() [1/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Bound ( const TheKeyType & theKey,
const TheItemType & theItem )
inline

Bound binds key to value and returns reference to the value.

Parameters
theKeykey to add/update
theItemnew item; overrides value previously bound to the key
Returns
reference to the value in the map

◆ Bound() [2/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Bound ( const TheKeyType & theKey,
TheItemType && theItem )
inline

Bound binds key to value and returns reference to the value.

◆ Bound() [3/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Bound ( TheKeyType && theKey,
const TheItemType & theItem )
inline

Bound binds key to value and returns reference to the value.

◆ Bound() [4/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Bound ( TheKeyType && theKey,
TheItemType && theItem )
inline

Bound binds key to value and returns reference to the value.

◆ Capacity()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
size_t NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Capacity ( ) const
inlinenoexcept

Returns current capacity.

◆ cbegin()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
Iterator NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::cbegin ( ) const
inlinenoexcept

Returns iterator to first element.

◆ cend()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
Iterator NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::cend ( ) const
inlinenoexcept

Returns iterator past the end.

◆ ChangeFind()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::ChangeFind ( const TheKeyType & theKey)
inline

Find value by key (mutable), throws if not found.

◆ ChangeSeek()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType * NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::ChangeSeek ( const TheKeyType & theKey)
inline

Find value by key (mutable), returns nullptr if not found.

◆ Clear()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Clear ( bool doReleaseMemory = false)
inline

Clear all elements.

Parameters
doReleaseMemoryif true, free the internal buffer

◆ Contained() [1/2]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
std::optional< std::pair< std::reference_wrapper< const TheKeyType >, std::reference_wrapper< TheItemType > > > NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Contained ( const TheKeyType & theKey)
inline

Contained returns optional pair of const key reference and mutable value reference. Returns std::nullopt if the key is not found.

◆ Contained() [2/2]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
std::optional< std::pair< std::reference_wrapper< const TheKeyType >, std::reference_wrapper< const TheItemType > > > NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Contained ( const TheKeyType & theKey) const
inline

Contained returns optional pair of const references to key and value. Returns std::nullopt if the key is not found.

◆ Emplace()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
template<typename K , typename... Args>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Emplace ( K && theKey,
Args &&... theArgs )
inline

Emplace constructs value in-place; if key exists, updates the value.

Parameters
theKeykey to add/update
theArgsarguments forwarded to value constructor
Returns
true if key was newly added, false if existing key was updated

◆ Emplaced()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
template<typename K , typename... Args>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Emplaced ( K && theKey,
Args &&... theArgs )
inline

Emplaced constructs value in-place; if key exists, updates the value.

Parameters
theKeykey to add/update
theArgsarguments forwarded to value constructor
Returns
reference to the value (existing updated or newly added)

◆ end()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
Iterator NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::end ( ) const
inlinenoexcept

Returns iterator past the end.

◆ Exchange()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Exchange ( NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher > & theOther)
inlinenoexcept

Exchange content with another map.

◆ Extent()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
int NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Extent ( ) const
inlinenoexcept

Returns number of elements (legacy int-returning API, convention shared with BaseMap).

◆ Find()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Find ( const TheKeyType & theKey) const
inline

Find value by key, throws if not found.

◆ GetHasher()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
const Hasher & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::GetHasher ( ) const
inlinenoexcept

Returns const reference to the hasher.

◆ IsBound()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::IsBound ( const TheKeyType & theKey) const
inline

Check if key exists.

◆ IsEmpty()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::IsEmpty ( ) const
inlinenoexcept

Returns true if map is empty.

◆ Items() [1/2]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
ItemsView NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Items ( )
inline

Returns a view for key-value pair iteration. Usage: for (auto [aKey, aValue] : aMap.Items())

◆ Items() [2/2]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
ConstItemsView NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Items ( ) const
inline

Returns a const view for key-value pair iteration. Usage: for (const auto& [aKey, aValue] : aMap.Items())

◆ operator()() [1/2]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::operator() ( const TheKeyType & theKey)
inline

Operator() for mutable access.

◆ operator()() [2/2]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::operator() ( const TheKeyType & theKey) const
inline

Operator() for const access.

◆ operator=() [1/2]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_FlatDataMap & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::operator= ( const NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher > & theOther)
inline

Copy assignment.

◆ operator=() [2/2]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_FlatDataMap & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::operator= ( NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher > && theOther)
inlinenoexcept

Move assignment.

◆ reserve()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::reserve ( size_t theN)
inline

Reserve capacity for at least theN elements.

◆ Seek()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheItemType * NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Seek ( const TheKeyType & theKey) const
inline

Find value by key, returns nullptr if not found.

◆ Size()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
size_t NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::Size ( ) const
inlinenoexcept

Returns number of elements.

◆ TryBind() [1/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::TryBind ( const TheKeyType & theKey,
const TheItemType & theItem )
inline

TryBind binds key to value only if key is not yet bound.

Parameters
theKeykey to add
theItemitem to bind if key is not yet bound
Returns
true if key was newly added, false if key already existed

◆ TryBind() [2/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::TryBind ( const TheKeyType & theKey,
TheItemType && theItem )
inline

TryBind binds key to value only if key is not yet bound.

◆ TryBind() [3/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::TryBind ( TheKeyType && theKey,
const TheItemType & theItem )
inline

TryBind binds key to value only if key is not yet bound.

◆ TryBind() [4/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::TryBind ( TheKeyType && theKey,
TheItemType && theItem )
inline

TryBind binds key to value only if key is not yet bound.

◆ TryBound() [1/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::TryBound ( const TheKeyType & theKey,
const TheItemType & theItem )
inline

TryBound binds key to value only if key is not yet bound.

Parameters
theKeykey to add
theItemitem to bind if key is not yet bound
Returns
reference to existing or newly bound value

◆ TryBound() [2/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::TryBound ( const TheKeyType & theKey,
TheItemType && theItem )
inline

TryBound binds key to value only if key is not yet bound.

◆ TryBound() [3/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::TryBound ( TheKeyType && theKey,
const TheItemType & theItem )
inline

TryBound binds key to value only if key is not yet bound.

◆ TryBound() [4/4]

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::TryBound ( TheKeyType && theKey,
TheItemType && theItem )
inline

TryBound binds key to value only if key is not yet bound.

◆ TryEmplace()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
template<typename K , typename... Args>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::TryEmplace ( K && theKey,
Args &&... theArgs )
inline

TryEmplace constructs value in-place only if key not already bound.

Parameters
theKeykey to add
theArgsarguments forwarded to value constructor
Returns
true if key was newly added, false if key already existed

◆ TryEmplaced()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
template<typename K , typename... Args>
TheItemType & NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::TryEmplaced ( K && theKey,
Args &&... theArgs )
inline

TryEmplaced constructs value in-place only if key not already bound.

Parameters
theKeykey to add
theArgsarguments forwarded to value constructor
Returns
reference to the value (existing or newly added)

◆ UnBind()

template<class TheKeyType , class TheItemType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_FlatDataMap< TheKeyType, TheItemType, Hasher >::UnBind ( const TheKeyType & theKey)
inline

Remove key from map.

Returns
true if key was found and removed

The documentation for this class was generated from the following file: