IOSS 2.0

Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash > Class Template Reference

`#include <robin_hash.h>`

## Public Types
using | value_type = ValueType
using | distance_type = std::int_least16_t

## Public Member Functions
| bucket_entry () noexcept
| bucket_entry (bool last_bucket_) noexcept
| bucket_entry (const bucket_entry &other) noexcept(std::is_nothrow_copy_constructible< value_type >::value)
| bucket_entry (bucket_entry &&other) noexcept(std::is_nothrow_move_constructible< value_type >::value)
bucket_entry & | operator= (const bucket_entry &other) noexcept(std::is_nothrow_copy_constructible< value_type >::value)
bucket_entry & | operator= (bucket_entry &&)=delete
| ~bucket_entry () noexcept
void | clear () noexcept
bool | empty () const noexcept
value_type & | value () noexcept
const value_type & | value () const noexcept
distance_type | dist_from_ideal_bucket () const noexcept
bool | last_bucket () const noexcept
void | set_as_last_bucket () noexcept
template<typename... Args>
void | set_value_of_empty_bucket (distance_type dist_from_ideal_bucket_, truncated_hash_type hash, Args &&... value_type_args)
void | swap_with_value_in_bucket (distance_type &dist_from_ideal_bucket_, truncated_hash_type &hash, value_type &value_)
Public Member Functions inherited from tsl::detail_robin_hash::bucket_entry_hash< StoreHash >
bool | bucket_hash_equal (std::size_t) const noexcept
truncated_hash_type | truncated_hash () const noexcept

## Static Public Member Functions
static truncated_hash_type | truncate_hash (std::size_t hash) noexcept

## Private Types
using | bucket_hash = bucket_entry_hash< StoreHash >
using | storage = typename std::aligned_storage< sizeof(value_type), alignof(value_type)>::type

## Private Member Functions
void | destroy_value () noexcept

## Private Attributes
distance_type | m_dist_from_ideal_bucket
bool | m_last_bucket
storage | m_value

## Static Private Attributes
static const distance_type | EMPTY_MARKER_DIST_FROM_IDEAL_BUCKET = -1

## Additional Inherited Members
Protected Member Functions inherited from tsl::detail_robin_hash::bucket_entry_hash< StoreHash >
void | set_hash (truncated_hash_type) noexcept

## Detailed Description

### template<typename ValueType, bool StoreHash>
class tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >

Each bucket entry has:

- A value of type `ValueType`.
- An integer to store how far the value of the bucket, if any, is from its ideal bucket (ex: if the current bucket 5 has the value 'foo' and ‘hash('foo’) % nb_buckets`== 3,` dist_from_ideal_bucket()` will return 2 as the current value of the bucket is two buckets away from its ideal bucket) If there is no value in the bucket (i.e. `empty()` is true) `dist_from_ideal_bucket()` will be < 0.
- A marker which tells us if the bucket is the last bucket of the bucket array (useful for the iterator of the hash table).
- If `StoreHash` is true, 32 bits of the hash of the value, if any, are also stored in the bucket. If the size of the hash is more than 32 bits, it is truncated. We don't store the full hash as storing the hash is a potential opportunity to use the unused space due to the alignement of the bucket_entry structure. We can thus potentially store the hash without any extra space (which would not be possible with 64 bits of the hash).

## Member Typedef Documentation

## ◆ bucket_hash

template<typename ValueType , bool StoreHash>

using tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::bucket_hash = bucket_entry_hash<StoreHash>
| private

## ◆ distance_type

template<typename ValueType , bool StoreHash>

using tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::distance_type = std::int_least16_t

## ◆ storage

template<typename ValueType , bool StoreHash>

using tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::storage = typename std::aligned_storage<sizeof(value_type), alignof(value_type)>::type
| private

## ◆ value_type

template<typename ValueType , bool StoreHash>

using tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::value_type = ValueType

## Constructor & Destructor Documentation

## ◆ bucket_entry() [1/4]

template<typename ValueType , bool StoreHash>

tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::bucket_entry | ( |  | ) |
| inline noexcept

## ◆ bucket_entry() [2/4]

template<typename ValueType , bool StoreHash>

tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::bucket_entry | ( | bool | last_bucket_ | ) |
| inline noexcept

## ◆ bucket_entry() [3/4]

template<typename ValueType , bool StoreHash>

tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::bucket_entry | ( | const bucket_entry< ValueType, StoreHash > & | other | ) |
| inline noexcept

## ◆ bucket_entry() [4/4]

template<typename ValueType , bool StoreHash>

tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::bucket_entry | ( | bucket_entry< ValueType, StoreHash > && | other | ) |
| inline noexcept

Never really used, but still necessary as we must call resize on an empty `std::vector<bucket_entry>`. and we need to support move-only types. See robin_hash constructor for details.

## ◆ ~bucket_entry()

template<typename ValueType , bool StoreHash>

tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::~bucket_entry | ( |  | ) |
| inline noexcept

## Member Function Documentation

## ◆ clear()

template<typename ValueType , bool StoreHash>

void tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::clear | ( |  | ) |
| inline noexcept

## ◆ destroy_value()

template<typename ValueType , bool StoreHash>

void tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::destroy_value | ( |  | ) |
| inline private noexcept

## ◆ dist_from_ideal_bucket()

template<typename ValueType , bool StoreHash>

distance_type tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::dist_from_ideal_bucket | ( |  | ) | const
| inline noexcept

## ◆ empty()

template<typename ValueType , bool StoreHash>

bool tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::empty | ( |  | ) | const
| inline noexcept

## ◆ last_bucket()

template<typename ValueType , bool StoreHash>

bool tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::last_bucket | ( |  | ) | const
| inline noexcept

## ◆ operator=() [1/2]

template<typename ValueType , bool StoreHash>

bucket_entry& tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::operator= | ( | const bucket_entry< ValueType, StoreHash > & | other | ) |
| inline noexcept

## ◆ operator=() [2/2]

template<typename ValueType , bool StoreHash>

bucket_entry& tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::operator= | ( | bucket_entry< ValueType, StoreHash > && |  | ) |
| delete

## ◆ set_as_last_bucket()

template<typename ValueType , bool StoreHash>

void tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::set_as_last_bucket | ( |  | ) |
| inline noexcept

## ◆ set_value_of_empty_bucket()

template<typename ValueType , bool StoreHash>
template<typename... Args>

void tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::set_value_of_empty_bucket | ( | distance_type | dist_from_ideal_bucket_,
|  | truncated_hash_type | hash,
|  | Args &&... | value_type_args
| ) |  |
| inline

## ◆ swap_with_value_in_bucket()

template<typename ValueType , bool StoreHash>

void tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::swap_with_value_in_bucket | ( | distance_type & | dist_from_ideal_bucket_,
|  | truncated_hash_type & | hash,
|  | value_type & | value_
| ) |  |
| inline

## ◆ truncate_hash()

template<typename ValueType , bool StoreHash>

static truncated_hash_type tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::truncate_hash | ( | std::size_t | hash | ) |
| inline static noexcept

## ◆ value() [1/2]

template<typename ValueType , bool StoreHash>

value_type& tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::value | ( |  | ) |
| inline noexcept

## ◆ value() [2/2]

template<typename ValueType , bool StoreHash>

const value_type& tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::value | ( |  | ) | const
| inline noexcept

## Member Data Documentation

## ◆ EMPTY_MARKER_DIST_FROM_IDEAL_BUCKET

template<typename ValueType , bool StoreHash>

const distance_type tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::EMPTY_MARKER_DIST_FROM_IDEAL_BUCKET = -1
| static private

## ◆ m_dist_from_ideal_bucket

template<typename ValueType , bool StoreHash>

distance_type tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::m_dist_from_ideal_bucket
| private

## ◆ m_last_bucket

template<typename ValueType , bool StoreHash>

bool tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::m_last_bucket
| private

## ◆ m_value

template<typename ValueType , bool StoreHash>

storage tsl::detail_robin_hash::bucket_entry< ValueType, StoreHash >::m_value
| private

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

- src/hash/robin_hash.h