|
kblib 0.2.3
General utilities library for modern C++
|
Provides generic facilities for hashing data, and aliases for standard unordered containers using the provided hash objects. More...
#include "iterators.h"#include "tdecl.h"#include "traits.h"#include "variant.h"#include <climits>#include <cstdint>#include <numeric>#include <string>#include <unordered_map>#include <unordered_set>#include <optional>#include <string_view>#include <variant>

Go to the source code of this file.
Namespaces | |
| namespace | kblib |
| The main namespace in which all entities from kblib are defined. | |
| namespace | kblib::fnv |
| namespace | kblib::literals |
| namespace | kblib::asserts |
| namespace | detail_hash |
| namespace | kblib::detail_hash |
Typedefs | |
| template<typename Key > | |
| using | kblib::FNV32_hash = FNV_hash< Key, std::uint32_t > |
| template<typename Key , typename Value > | |
| using | kblib::hash_map = std::unordered_map< Key, Value, FNV_hash<>, std::equal_to<> > |
| template<typename Key , typename Value > | |
| using | kblib::hash_multimap = std::unordered_multimap< Key, Value, FNV_hash<>, std::equal_to<> > |
| template<typename T , typename HashInt > | |
| using | kblib::hash_set = std::unordered_set< T, FNV_hash<>, std::equal_to<> > |
| template<typename T , typename HashInt > | |
| using | kblib::hash_multiset = std::unordered_set< T, FNV_hash<>, std::equal_to<> > |
Functions | |
| template<typename Integral , typename CharT > | |
| constexpr auto | kblib::to_bytes_le (Integral ival, CharT(&dest)[sizeof(Integral)]) noexcept -> void |
| template<typename Integral , typename CharT > | |
| constexpr auto | kblib::to_bytes_be (Integral ival, CharT(&dest)[sizeof(Integral)]) noexcept -> void |
| template<typename Integral , typename CharT > | |
| constexpr auto | kblib::to_bytes (Integral val, CharT(&dest)[sizeof(Integral)]) noexcept -> void |
| template<typename HashInt , typename Span > | |
| constexpr auto | kblib::FNVa (Span &&s, HashInt hval=fnv::fnv_offset< HashInt >::value) noexcept -> HashInt |
| A templatized generic FNVa hash function. More... | |
| template<typename HashInt , typename CharT , std::size_t N> | |
| constexpr auto | kblib::FNVa_a (const CharT(&s)[N], HashInt hval=fnv::fnv_offset< HashInt >::value) noexcept -> HashInt |
| A templatized FNVa hash function, for raw character arrays, such as string literals. More... | |
| constexpr auto | kblib::FNV32a (std::string_view s, std::uint32_t hval=fnv::fnv_offset< std::uint32_t >::value) noexcept -> std::uint32_t |
| A standard FNV32a hash function, for string_views. More... | |
| template<typename HashInt > | |
| constexpr auto | kblib::FNVa_s (const char *begin, std::size_t length, HashInt hval=fnv::fnv_offset< HashInt >::value) noexcept -> HashInt |
| template<std::size_t N> | |
| constexpr auto | kblib::FNV32a_a (const char(&s)[N], std::uint32_t hval=fnv::fnv_offset< std::uint32_t >::value) noexcept -> std::uint32_t |
| A standard FNV32a hash function, for raw character arrays, such as string literals. More... | |
| constexpr auto | kblib::FNV32a_s (const char *begin, std::size_t length, uint32_t hval=fnv::fnv_offset< std::uint32_t >::value) noexcept -> std::uint32_t |
| constexpr auto | kblib::literals::operator""_fnv32 (const char *str, std::size_t length) noexcept -> std::uint32_t |
| A literal suffix that produces the FNV32a hash of a string literal. More... | |
| constexpr auto | kblib::literals::operator""_fnv64 (const char *str, std::size_t length) noexcept -> std::uint64_t |
| A literal suffix that produces the FNV64a hash of a string literal. More... | |
| constexpr auto | kblib::literals::operator""_fnv32 (unsigned long long val) -> std::uint32_t |
| constexpr auto | kblib::literals::operator""_fnv64 (unsigned long long val) -> std::uint64_t |
| template<typename Tuple , typename HashInt , std::size_t I> | |
| constexpr auto | kblib::detail_hash::hash_tuple_impl (const Tuple &tuple, HashInt offset, std::index_sequence< I >) noexcept -> HashInt |
| Hash each element of a tuple. This overload is for tuples of a single type, or as the base case for the other overload. More... | |
| template<typename Tuple , typename HashInt , std::size_t I, std::size_t I2, std::size_t... Is> | |
| constexpr auto | kblib::detail_hash::hash_tuple_impl (const Tuple &tuple, HashInt offset, std::index_sequence< I, I2, Is... >) noexcept -> HashInt |
| Hash each element of a tuple. This overload is for tuples of at least 2 elements. More... | |
| template<typename Tuple , std::size_t... Is> | |
| constexpr auto | kblib::detail_hash::all_hashable_impl (std::index_sequence< Is... >) -> bool |
| template<typename Tuple , typename std::enable_if<(std::tuple_size< Tuple >::value > 0u), int >::type = 0> | |
| constexpr auto | kblib::detail_hash::all_hashable () -> bool |
Variables | |
| template<typename T > | |
| constexpr int | kblib::padding_bits_v |
| Get the number of padding bits in an integral type. More... | |
| template<> | |
| constexpr int | kblib::padding_bits_v< void > = 0 |
| template<typename Key > | |
| KBLIB_CONSTANT_V | kblib::is_hashable_v = is_hashable<Key>::value |
| template<typename T > | |
| KBLIB_CONSTANT_V | kblib::is_trivially_hashable_v |
| template<typename Container > | |
| KBLIB_CONSTANT_V | kblib::asserts::is_trivial_container |
Provides generic facilities for hashing data, and aliases for standard unordered containers using the provided hash objects.
Definition in file hash.h.