Public Member Functions |
| | array_map () |
| |
| | array_map (size_typebucket_count, const Hash &hash=Hash()) |
| |
| template<class InputIt , typename std::enable_if< is_iterator< InputIt >::value >::type * = nullptr> |
| | array_map (InputIt first, InputIt last,size_typebucket_count=ht::DEFAULT_INIT_BUCKET_COUNT, const Hash &hash=Hash()) |
| |
| | array_map (std::initializer_list< std::pair< std::basic_string_view< CharT >, T >> init,size_typebucket_count=ht::DEFAULT_INIT_BUCKET_COUNT, const Hash &hash=Hash()) |
| |
| array_map & | operator= (std::initializer_list< std::pair< std::basic_string_view< CharT >, T >> ilist) |
| |
| 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 |
| |
| size_type | max_key_size () const noexcept |
| |
| void | shrink_to_fit () |
| |
| void | clear () noexcept |
| |
| std::pair<iterator, bool > | insert (const std::basic_string_view< CharT > &key, const T &value) |
| |
| std::pair<iterator, bool > | insert_ks (const CharT *key,size_type key_size, const T &value) |
| |
| std::pair<iterator, bool > | insert (const std::basic_string_view< CharT > &key, T &&value) |
| |
| std::pair<iterator, bool > | insert_ks (const CharT *key,size_type key_size, T &&value) |
| |
| template<class InputIt , typename std::enable_if< is_iterator< InputIt >::value >::type * = nullptr> |
| void | insert (InputIt first, InputIt last) |
| |
| void | insert (std::initializer_list< std::pair< std::basic_string_view< CharT >, T >> ilist) |
| |
| template<class M > |
| std::pair<iterator, bool > | insert_or_assign (const std::basic_string_view< CharT > &key, M &&obj) |
| |
| template<class M > |
| std::pair<iterator, bool > | insert_or_assign_ks (const CharT *key,size_type key_size, M &&obj) |
| |
| template<class... Args> |
| std::pair<iterator, bool > | emplace (const std::basic_string_view< CharT > &key, Args &&... args) |
| |
| template<class... Args> |
| std::pair<iterator, bool > | emplace_ks (const CharT *key,size_type key_size, Args &&... args) |
| |
| iterator | erase (const_iterator pos) |
| |
| iterator | erase (const_iterator first,const_iterator last) |
| |
| size_type | erase (const std::basic_string_view< CharT > &key) |
| |
| size_type | erase_ks (const CharT *key,size_type key_size) |
| |
| size_type | erase (const std::basic_string_view< CharT > &key, std::size_t precalculated_hash) |
| |
| size_type | erase_ks (const CharT *key,size_type key_size, std::size_t precalculated_hash) |
| |
| void | swap (array_map &other) |
| |
| T & | at (const std::basic_string_view< CharT > &key) |
| |
| const T & | at (const std::basic_string_view< CharT > &key) const |
| |
| T & | at_ks (const CharT *key,size_type key_size) |
| |
| const T & | at_ks (const CharT *key,size_type key_size) const |
| |
| T & | at (const std::basic_string_view< CharT > &key, std::size_t precalculated_hash) |
| |
| const T & | at (const std::basic_string_view< CharT > &key, std::size_t precalculated_hash) const |
| |
| T & | at_ks (const CharT *key,size_type key_size, std::size_t precalculated_hash) |
| |
| const T & | at_ks (const CharT *key,size_type key_size, std::size_t precalculated_hash) const |
| |
| T & | operator[] (const std::basic_string_view< CharT > &key) |
| |
| size_type | count (const std::basic_string_view< CharT > &key) const |
| |
| size_type | count_ks (const CharT *key,size_type key_size) const |
| |
| size_type | count (const std::basic_string_view< CharT > &key, std::size_t precalculated_hash) const |
| |
| size_type | count_ks (const CharT *key,size_type key_size, std::size_t precalculated_hash) const |
| |
| iterator | find (const std::basic_string_view< CharT > &key) |
| |
| const_iterator | find (const std::basic_string_view< CharT > &key) const |
| |
| iterator | find_ks (const CharT *key,size_type key_size) |
| |
| const_iterator | find_ks (const CharT *key,size_type key_size) const |
| |
| iterator | find (const std::basic_string_view< CharT > &key, std::size_t precalculated_hash) |
| |
| const_iterator | find (const std::basic_string_view< CharT > &key, std::size_t precalculated_hash) const |
| |
| iterator | find_ks (const CharT *key,size_type key_size, std::size_t precalculated_hash) |
| |
| const_iterator | find_ks (const CharT *key,size_type key_size, std::size_t precalculated_hash) const |
| |
| std::pair<iterator,iterator > | equal_range (const std::basic_string_view< CharT > &key) |
| |
| std::pair<const_iterator,const_iterator > | equal_range (const std::basic_string_view< CharT > &key) const |
| |
| std::pair<iterator,iterator > | equal_range_ks (const CharT *key,size_type key_size) |
| |
| std::pair<const_iterator,const_iterator > | equal_range_ks (const CharT *key,size_type key_size) const |
| |
| std::pair<iterator,iterator > | equal_range (const std::basic_string_view< CharT > &key, std::size_t precalculated_hash) |
| |
| std::pair<const_iterator,const_iterator > | equal_range (const std::basic_string_view< CharT > &key, std::size_t precalculated_hash) const |
| |
| std::pair<iterator,iterator > | equal_range_ks (const CharT *key,size_type key_size, std::size_t precalculated_hash) |
| |
| std::pair<const_iterator,const_iterator > | equal_range_ks (const CharT *key,size_type key_size, std::size_t precalculated_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_typecount) |
| |
| void | reserve (size_typecount) |
| |
| hasher | hash_function () const |
| |
| key_equal | key_eq () const |
| |
| iterator | mutable_iterator (const_iterator it) noexcept |
| |
| template<class Serializer > |
| void | serialize (Serializer &serializer) const |
| |
template<class CharT, class T, class Hash = tsl::ah::str_hash<CharT>, class KeyEqual = tsl::ah::str_equal<CharT>, bool StoreNullTerminator = true, class KeySizeT = std::uint16_t, class IndexSizeT = std::uint32_t, class GrowthPolicy = tsl::ah::power_of_two_growth_policy<2>>
class tsl::array_map< CharT, T, Hash, KeyEqual, StoreNullTerminator, KeySizeT, IndexSizeT, GrowthPolicy >
Implementation of a cache-conscious string hash map.
The map stores the strings asconst CharT*. IfStoreNullTerminator is true, the strings are stored with the a null-terminator (thekey() method of the iterators will return a pointer to this null-terminated string). Otherwise the null character is not stored (which allow an economy of 1 byte per string).
The valueT must be either nothrow move-constructible, copy-constuctible or both.
The size of a key string is limited tostd::numeric_limits<KeySizeT>::max() - 1. That is 65 535 characters by default, but can be raised with theKeySizeT template parameter. Seemax_key_size() for an easy access to this limit.
The number of elements in the map is limited tostd::numeric_limits<IndexSizeT>::max(). That is 4 294 967 296 elements, but can be raised with theIndexSizeT template parameter. Seemax_size() for an easy access to this limit.
Iterators invalidation:
- clear, operator=: always invalidate the iterators.
- insert, emplace, operator[]: always invalidate the iterators.
- erase: always invalidate the iterators.
- shrink_to_fit: always invalidate the iterators.
template<class CharT , class T , class Hash = tsl::ah::str_hash<CharT>, class KeyEqual = tsl::ah::str_equal<CharT>, bool StoreNullTerminator = true, class KeySizeT = std::uint16_t, class IndexSizeT = std::uint32_t, class GrowthPolicy = tsl::ah::power_of_two_growth_policy<2>>
template<class Deserializer >
| staticarray_maptsl::array_map< CharT, T, Hash, KeyEqual, StoreNullTerminator, KeySizeT, IndexSizeT, GrowthPolicy >::deserialize | ( | Deserializer & | deserializer, | | | bool | hash_compatible =false | | ) | | |
| inlinestatic |
Deserialize a previouly serialized map through thedeserializer parameter.
Thedeserializer parameter must be a function object that supports the following calls:
template<typename U> U operator()(); where the typesstd::uint64_t,float andT must be supported for U.void operator()(CharT* value_out, std::size_t value_size);
If the deserialized hash map type is hash compatible with the serialized map, the deserialization process can be sped up by settinghash_compatible to true. To be hash compatible, the Hash (take care of the 32-bits vs 64 bits), KeyEqual, GrowthPolicy, StoreNullTerminator, KeySizeT and IndexSizeT must behave the same than the one used on the serialazed map. Otherwise the behaviour is undefined withhash_compatible sets to true, .
The behaviour is undefined if the typeCharT andT of thearray_map are not the same as the types used during serialization.
The implementation leaves binary compatibilty (endianness, IEEE 754 for floats, ...) of the types it deserializes in the hands of theDeserializer function object if compatibilty is required.