Inherits Allocator, Hash, KeyEqual, and GrowthPolicy.
|
| sparse_hash (size_type bucket_count, const Hash &hash, const KeyEqual &equal, const Allocator &alloc, float max_load_factor) |
|
| ~sparse_hash () |
|
| sparse_hash (const sparse_hash &other) |
|
| sparse_hash (sparse_hash &&other) noexcept(std::is_nothrow_move_constructible< Allocator >::value &&std::is_nothrow_move_constructible< Hash >::value &&std::is_nothrow_move_constructible< KeyEqual >::value &&std::is_nothrow_move_constructible< GrowthPolicy >::value &&std::is_nothrow_move_constructible< sparse_buckets_container >::value) |
|
sparse_hash & | operator= (const sparse_hash &other) |
|
sparse_hash & | operator= (sparse_hash &&other) |
|
allocator_type | get_allocator () const |
|
iterator | begin () noexcept |
|
const_iterator | begin () const noexcept |
|
const_iterator | cbegin () const noexcept |
|
iterator | end () noexcept |
|
const_iterator | end () const noexcept |
|
const_iterator | cend () const noexcept |
|
bool | empty () const noexcept |
|
size_type | size () const noexcept |
|
size_type | max_size () const noexcept |
|
void | clear () noexcept |
|
template<typename P > |
std::pair< iterator, bool > | insert (P &&value) |
|
template<typename P > |
iterator | insert (const_iterator hint, P &&value) |
|
template<class InputIt > |
void | insert (InputIt first, InputIt last) |
|
template<class K , class M > |
std::pair< iterator, bool > | insert_or_assign (K &&key, M &&obj) |
|
template<class K , class M > |
iterator | insert_or_assign (const_iterator hint, K &&key, M &&obj) |
|
template<class... Args> |
std::pair< iterator, bool > | emplace (Args &&... args) |
|
template<class... Args> |
iterator | emplace_hint (const_iterator hint, Args &&... args) |
|
template<class K , class... Args> |
std::pair< iterator, bool > | try_emplace (K &&key, Args &&... args) |
|
template<class K , class... Args> |
iterator | try_emplace (const_iterator hint, K &&key, Args &&... args) |
|
iterator | erase (iterator pos) |
|
iterator | erase (const_iterator pos) |
|
iterator | erase (const_iterator first, const_iterator last) |
|
template<class K > |
size_type | erase (const K &key) |
|
template<class K > |
size_type | erase (const K &key, std::size_t hash) |
|
void | swap (sparse_hash &other) |
|
template<class K , class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value >::type * = nullptr> |
U::value_type & | at (const K &key) |
|
template<class K , class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value >::type * = nullptr> |
U::value_type & | at (const K &key, std::size_t hash) |
|
template<class K , class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value >::type * = nullptr> |
const U::value_type & | at (const K &key) const |
|
template<class K , class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value >::type * = nullptr> |
const U::value_type & | at (const K &key, std::size_t hash) const |
|
template<class K , class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value >::type * = nullptr> |
U::value_type & | operator[] (K &&key) |
|
template<class K > |
size_type | count (const K &key) const |
|
template<class K > |
size_type | count (const K &key, std::size_t hash) const |
|
template<class K > |
iterator | find (const K &key) |
|
template<class K > |
iterator | find (const K &key, std::size_t hash) |
|
template<class K > |
const_iterator | find (const K &key) const |
|
template<class K > |
const_iterator | find (const K &key, std::size_t hash) const |
|
template<class K > |
std::pair< iterator, iterator > | equal_range (const K &key) |
|
template<class K > |
std::pair< iterator, iterator > | equal_range (const K &key, std::size_t hash) |
|
template<class K > |
std::pair< const_iterator, const_iterator > | equal_range (const K &key) const |
|
template<class K > |
std::pair< const_iterator, const_iterator > | equal_range (const K &key, std::size_t hash) const |
|
size_type | bucket_count () const |
|
size_type | max_bucket_count () const |
|
float | load_factor () const |
|
float | max_load_factor () const |
|
void | max_load_factor (float ml) |
|
void | rehash (size_type count) |
|
void | reserve (size_type count) |
|
hasher | hash_function () const |
|
key_equal | key_eq () const |
|
iterator | mutable_iterator (const_iterator pos) |
|
template<class Serializer > |
void | serialize (Serializer &serializer) const |
|
template<class Deserializer > |
void | deserialize (Deserializer &deserializer, bool hash_compatible) |
|
sparse_array * | static_empty_sparse_bucket_ptr () |
|
template<class ValueType, class KeySelect, class ValueSelect, class Hash, class KeyEqual, class Allocator, class GrowthPolicy, tsl::sh::exception_safety ExceptionSafety, tsl::sh::sparsity Sparsity, tsl::sh::probing Probing>
class tsl::detail_sparse_hash::sparse_hash< ValueType, KeySelect, ValueSelect, Hash, KeyEqual, Allocator, GrowthPolicy, ExceptionSafety, Sparsity, Probing >
Internal common class used by sparse_map
and sparse_set
.
ValueType
is what will be stored by sparse_hash
(usually std::pair<Key, T>
for map and Key
for set).
KeySelect
should be a FunctionObject
which takes a ValueType
in parameter and returns a reference to the key.
ValueSelect
should be a FunctionObject
which takes a ValueType
in parameter and returns a reference to the value. ValueSelect
should be void if there is no value (in a set for example).
The strong exception guarantee only holds if ExceptionSafety
is set to tsl::sh::exception_safety::strong
.
ValueType
must be nothrow move contructible and/or copy constructible. Behaviour is undefined if the destructor of ValueType
throws.
The class holds its buckets in a 2-dimensional fashion. Instead of having a linear std::vector<bucket>
for [0, bucket_count) where each bucket stores one value, we have a std::vector<sparse_array>
(m_sparse_buckets) where each sparse_array
stores multiple values (up to sparse_array::BITMAP_NB_BITS
). To convert a one dimensional ibucket
position to a position in std::vector<sparse_array>
and a position in sparse_array
, use respectively the methods sparse_array::sparse_ibucket(ibucket)
and sparse_array::index_in_sparse_bucket(ibucket)
.
template<class ValueType, class KeySelect, class ValueSelect, class Hash, class KeyEqual, class Allocator, class GrowthPolicy, tsl::sh::exception_safety ExceptionSafety, tsl::sh::sparsity Sparsity, tsl::sh::probing Probing>
template<class K , class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value >::type * = nullptr>
U::value_type& tsl::detail_sparse_hash::sparse_hash< ValueType, KeySelect, ValueSelect, Hash, KeyEqual, Allocator, GrowthPolicy, ExceptionSafety, Sparsity, Probing >::at |
( |
const K & |
key | ) |
|
|
inline |
template<class ValueType, class KeySelect, class ValueSelect, class Hash, class KeyEqual, class Allocator, class GrowthPolicy, tsl::sh::exception_safety ExceptionSafety, tsl::sh::sparsity Sparsity, tsl::sh::probing Probing>
template<class K , class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value >::type * = nullptr>
U::value_type& tsl::detail_sparse_hash::sparse_hash< ValueType, KeySelect, ValueSelect, Hash, KeyEqual, Allocator, GrowthPolicy, ExceptionSafety, Sparsity, Probing >::at |
( |
const K & |
key, |
|
|
std::size_t |
hash |
|
) |
| |
|
inline |
template<class ValueType, class KeySelect, class ValueSelect, class Hash, class KeyEqual, class Allocator, class GrowthPolicy, tsl::sh::exception_safety ExceptionSafety, tsl::sh::sparsity Sparsity, tsl::sh::probing Probing>
template<class K , class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value >::type * = nullptr>
const U::value_type& tsl::detail_sparse_hash::sparse_hash< ValueType, KeySelect, ValueSelect, Hash, KeyEqual, Allocator, GrowthPolicy, ExceptionSafety, Sparsity, Probing >::at |
( |
const K & |
key | ) |
const |
|
inline |
template<class ValueType, class KeySelect, class ValueSelect, class Hash, class KeyEqual, class Allocator, class GrowthPolicy, tsl::sh::exception_safety ExceptionSafety, tsl::sh::sparsity Sparsity, tsl::sh::probing Probing>
template<class K , class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value >::type * = nullptr>
const U::value_type& tsl::detail_sparse_hash::sparse_hash< ValueType, KeySelect, ValueSelect, Hash, KeyEqual, Allocator, GrowthPolicy, ExceptionSafety, Sparsity, Probing >::at |
( |
const K & |
key, |
|
|
std::size_t |
hash |
|
) |
| const |
|
inline |
template<class ValueType, class KeySelect, class ValueSelect, class Hash, class KeyEqual, class Allocator, class GrowthPolicy, tsl::sh::exception_safety ExceptionSafety, tsl::sh::sparsity Sparsity, tsl::sh::probing Probing>
template<class K , class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value >::type * = nullptr>
U::value_type& tsl::detail_sparse_hash::sparse_hash< ValueType, KeySelect, ValueSelect, Hash, KeyEqual, Allocator, GrowthPolicy, ExceptionSafety, Sparsity, Probing >::operator[] |
( |
K && |
key | ) |
|
|
inline |