ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable > Class Template Reference

Description:

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
class alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >

Templated implementation of std::iterator_traits. Will be exposed by derived class's definitions Iterator and ConstIterator.

As the name of the class indicates, this iterator satisfies the C++ standard library concept ForwardIterator .

Template Parameters
TConstOrMutableA constant or mutable version of the parent's template type TMapped.

Definition at line 221 of file hashtablebase.inl.

Public Method Index:

 TIterator ()=default
 Default constructor. Keeps everything uninitialized.
 
 TIterator (const TIterator &other)=default
 
template<typename TMutable>
requires std::same_as<TMutable, TIterator<T>>
 TIterator (const TMutable &mutableIt)
 
const TKeyKey () const
 
TMappedMapped () const
 
bool operator!= (TIterator other) const
 
TConstOrMutable & operator* () const
 
TIteratoroperator++ ()
 
TIterator operator++ (int)
 
TConstOrMutable * operator-> () const
 
TIteratoroperator= (const TIterator &other)=default
 
bool operator== (TIterator other) const
 
TConstOrMutable & Value () const
 

Protected Field Index:

uinteger bucketIdx
 The actual bucket index.
 
Elementelement
 The pointer to the actual element.
 
THashtabletable
 The pointer to the hash table.
 

Protected Method Index:

 TIterator (THashtable *pTable, uinteger pBbucketIx)
 
 TIterator (THashtable *pTable, uinteger pBbucketIx, Element *pElement)
 
void repair ()
 Moves an iterator with a nulled element pointer to the next element.
 

Private Type Index:

using difference_type = integer
 Implementation of std::iterator_traits.
 
using iterator_category = std::forward_iterator_tag
 Implementation of std::iterator_traits.
 
using pointer = TConstOrMutable*
 Implementation of std::iterator_traits.
 
using reference = TConstOrMutable&
 Implementation of std::iterator_traits.
 
using THashtable
 Const or mutable version of HashTableBase.
 
using value_type = TMapped
 Implementation of std::iterator_traits.
 

Type Definition Details:

◆ difference_type

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
using alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::difference_type = integer
private

Implementation of std::iterator_traits.

Definition at line 234 of file hashtablebase.inl.

◆ iterator_category

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
using alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::iterator_category = std::forward_iterator_tag
private

Implementation of std::iterator_traits.

Definition at line 232 of file hashtablebase.inl.

◆ pointer

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
using alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::pointer = TConstOrMutable*
private

Implementation of std::iterator_traits.

Definition at line 235 of file hashtablebase.inl.

◆ reference

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
using alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::reference = TConstOrMutable&
private

Implementation of std::iterator_traits.

Definition at line 236 of file hashtablebase.inl.

◆ THashtable

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
using alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::THashtable
private
Initial value:
std::conditional_t< !std::is_const_v< TConstOrMutable>,
const HashTableBase >
HashTableBase(TAllocator &pAllocator, float pBaseLoadFactor, float pMaxLoadFactor)

Const or mutable version of HashTableBase.

Definition at line 229 of file hashtablebase.inl.

◆ value_type

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
using alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::value_type = TMapped
private

Implementation of std::iterator_traits.

Definition at line 233 of file hashtablebase.inl.

Field Details:

◆ bucketIdx

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
uinteger alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::bucketIdx
protected

The actual bucket index.

Definition at line 243 of file hashtablebase.inl.

◆ element

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
Element* alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::element
protected

The pointer to the actual element.

Definition at line 246 of file hashtablebase.inl.

◆ table

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
THashtable* alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::table
protected

The pointer to the hash table.

Definition at line 240 of file hashtablebase.inl.

Constructor(s) / Destructor Details:

◆ TIterator() [1/4]

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::TIterator ( THashtable * pTable,
uinteger pBbucketIx )
inlineprotected

Internal constructor. Searches the first element, starting with given bucket number.

Parameters
pTablePointer to the hash table.
pBbucketIxThe bucket index.

Definition at line 253 of file hashtablebase.inl.

◆ TIterator() [2/4]

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::TIterator ( THashtable * pTable,
uinteger pBbucketIx,
Element * pElement )
inlineprotected

Internal constructor creating a specific iterator.

Parameters
pTablePointer to the hash table.
pBbucketIxThe bucket index.
pElementPointer to the current element.

Definition at line 274 of file hashtablebase.inl.

◆ TIterator() [3/4]

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::TIterator ( const TIterator< TConstOrMutable > & other)
default

Copy constructor (default).

Parameters
otherThe iterator to assign from.
Here is the call graph for this function:

◆ TIterator() [4/4]

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
template<typename TMutable>
requires std::same_as<TMutable, TIterator<T>>
alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::TIterator ( const TMutable & mutableIt)
inline

Copy constructor accepting a mutable iterator. Available only for the constant version of this iterator.

Template Parameters
TMutableThe type of this constructor's argument.
Parameters
mutableItMutable iterator to copy from.

Definition at line 313 of file hashtablebase.inl.

Method Details:

◆ Key()

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
const TKey & alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::Key ( ) const
inline

Retrieves the key-portion of the stored object that this iterator references.

Returns
A reference to the key-portion of the stored object.

Definition at line 398 of file hashtablebase.inl.

◆ Mapped()

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
TMapped & alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::Mapped ( ) const
inline

Retrieves the mapped-portion of the stored object that this iterator references. This method is an alias to operator*

Returns
A reference to the mapped-portion of the stored object.

Definition at line 407 of file hashtablebase.inl.

◆ operator!=()

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
bool alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::operator!= ( TIterator< TConstOrMutable > other) const
inline

Comparison operator.

Parameters
otherThe iterator to compare ourselves to.
Returns
true if this and given iterator are not equal, false otherwise.

Definition at line 364 of file hashtablebase.inl.

Here is the call graph for this function:

◆ operator*()

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
TConstOrMutable & alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::operator* ( ) const
inline

Retrieves the stored object that this iterator references.

Returns
A reference to the stored object.

Definition at line 374 of file hashtablebase.inl.

◆ operator++() [1/2]

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
TIterator & alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::operator++ ( )
inline

Prefix increment operator.

Returns
A reference to this object.

Definition at line 322 of file hashtablebase.inl.

Here is the call graph for this function:

◆ operator++() [2/2]

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
TIterator alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::operator++ ( int )
inline

Postfix increment operator.

Returns
An iterator value that is not increased, yet.

Definition at line 345 of file hashtablebase.inl.

Here is the call graph for this function:

◆ operator->()

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
TConstOrMutable * alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::operator-> ( ) const
inline

Retrieves a pointer to the stored object that this iterator references.

Returns
A pointer to the stored object.

Definition at line 382 of file hashtablebase.inl.

◆ operator=()

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
TIterator & alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::operator= ( const TIterator< TConstOrMutable > & other)
default

Copy assignment (default).

Parameters
otherThe iterator to assign from.
Returns
A reference to this object.
Here is the call graph for this function:

◆ operator==()

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
bool alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::operator== ( TIterator< TConstOrMutable > other) const
inline

Comparison operator.

Parameters
otherThe iterator to compare ourselves to.
Returns
true if this and the given iterator are pointing to the same element, false otherwise.

Definition at line 356 of file hashtablebase.inl.

Here is the call graph for this function:

◆ repair()

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
void alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::repair ( )
inlineprotected

Moves an iterator with a nulled element pointer to the next element.

Definition at line 281 of file hashtablebase.inl.

◆ Value()

template<typename TAllocator, typename TValueDescriptor, typename THash, typename TEqual, lang::Caching THashCaching, Recycling TRecycling>
template<typename TConstOrMutable>
TConstOrMutable & alib::containers::detail::HashTableBase< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling >::TIterator< TConstOrMutable >::Value ( ) const
inline

Retrieves the stored object that this iterator references.

Returns
A reference to the stored object.

Definition at line 390 of file hashtablebase.inl.


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