ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
TPairDescriptor< TKey, TMapped > Struct Template Reference

Description:

template<typename TKey, typename TMapped>
struct alib::containers::TPairDescriptor< TKey, TMapped >

Implements template type TValueDescriptor, which is, for example, offered by types HashTable and LRUCacheTable.

Specifically, this implementation is used when the custom type to be stored with a container should be associated to a TKkey-type, which is not included in the stored type itself. Consequently, to associate custom type TMapped with the key, the StoredType results in std::pair<TKey,TMapped.

Type definitions HashMap and LRUCacheMap establish a shortcut to their corresponding base type, which incorporates this helper.

Template Parameters
TKeyThe key type.
TMappedThe type of the mapped objects.

Definition at line 32 of file valuedescriptor.hpp.

#include <valuedescriptor.hpp>

Public Type Index:

using KeyType = TKey
 
using MappedType = TMapped
 
using StoredType = std::pair<TKey, TMapped>
 

Public Method Index:

TKey & Key (std::pair< TKey, TMapped > &src) const
 
TMapped & Mapped (std::pair< TKey, TMapped > &src) const
 

Type Definition Details:

◆ KeyType

template<typename TKey , typename TMapped >
using KeyType = TKey

The key type. (Exposes template parameter TKey).
Container types typically publish an alias to this type. For example, see KeyType, or see KeyType.

Definition at line 44 of file valuedescriptor.hpp.

◆ MappedType

template<typename TKey , typename TMapped >
using MappedType = TMapped

The type associated to a key. (Exposes template parameter TMapped). The type of the mapped portion of the data.
Container types typically publish an alias to this type. For example, see MappedType, or see MappedType.

Definition at line 51 of file valuedescriptor.hpp.

◆ StoredType

template<typename TKey , typename TMapped >
using StoredType = std::pair<TKey, TMapped>

The type stored in the container.
Container types typically publish an alias to this type. For example, see StoredType, or see StoredType.

Definition at line 38 of file valuedescriptor.hpp.

Method Details:

◆ Key()

template<typename TKey , typename TMapped >
TKey & Key ( std::pair< TKey, TMapped > & src) const
inline

Returns the first element of the given std::pair.

Parameters
srcThe value to extract from.
Returns
The key-portion of the given value.

Definition at line 56 of file valuedescriptor.hpp.

◆ Mapped()

template<typename TKey , typename TMapped >
TMapped & Mapped ( std::pair< TKey, TMapped > & src) const
inline

Returns the second element of the given std::pair.

Parameters
srcThe value to extract from.
Returns
The mapped-portion of the given value.

Definition at line 61 of file valuedescriptor.hpp.


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