8#include <unordered_map>
21static_assert(kblib::is_linear_container_v<std::string>
22 and kblib::is_contiguous_v<std::string>
23 and kblib::is_trivially_hashable_v<std::string::value_type>
24 and kblib::is_trivially_hashable_v<int*>,
26static_assert(kblib::asserts::is_trivial_container<std::vector<char>>,
"");
29static_assert(kblib::is_trivially_hashable_v<no_padding>);
31 std::declval<no_padding&>())),
33static_assert(std::is_default_constructible_v<kblib::FNV_hash<no_padding>>
39static constexpr bool is_disabled_hash
43static constexpr bool is_enabled_hash
44 = std::is_nothrow_default_constructible_v<kblib::FNV_hash<T>>
45 and std::is_invocable_r_v<std::size_t, kblib::FNV_hash<T>,
const T&>;
61 std::unordered_map<std::tuple<std::wstring, int*>,
66 std::vector<std::array<bool, 16>>>;
67 static_assert(std::is_same<
decltype(test_map), map_t>
::value,
"");
74 std::vector<std::array<bool, 16>>>>
77 KBLIB_UNUSED auto call = &
decltype(test_hash1)::operator();
83 static_assert(3452452_fnv64 == h_i(3452452ull),
84 "hash literal and FNH_hash don't agree");
90 static_assert(is_disabled_hash<std::vector<has_padding>>);
92 static_assert(is_disabled_hash<std::unordered_map<int, int>>);
98 (void)test_opt_hash(std::nullopt);
99 (void)test_opt_hash(42);
102 std::variant<int, int, std::string> var(std::in_place_index<1>, 42);
106 == test_var_hash(
decltype(var){std::in_place_index<0>, 42}));
117 (void)
kblib::FNV_hash<std::tuple<std::wstring, int*>, std::uint32_t>{}({});
119 (void)
kblib::FNV_hash<std::vector<int>::iterator, std::uint32_t>{}({});
120 (void)
kblib::FNV_hash<std::deque<char>::iterator, std::uint32_t>{}({});
133 std::vector<std::array<bool, 16>>>,
139 KBLIB_UNUSED auto call = &
decltype(test_hash1)::operator();
145 static_assert(3452452_fnv32 == h_i(3452452u),
146 "hash literal and FNH_hash don't agree");
160 (void)test_opt_hash(std::nullopt);
161 (void)test_opt_hash(42);
164 std::variant<int, int, std::string> var(std::in_place_index<1>, 42);
168 == test_var_hash(
decltype(var){std::in_place_index<0>, 42}));
Provides generic facilities for hashing data, and aliases for standard unordered containers using the...
GeneratorWrapper< T > value(T &&value)
constexpr bool is_invocable_v
constexpr bool is_invocable_r_v
std::unordered_map< Key, Value, FNV_hash<>, std::equal_to<> > hash_map
The primary template has to exist, but not be constructible, in order to be compatible with std::hash...
#define KBLIB_UNUSED
This internal macro is used to provide a fallback for [[maybe_unused]] in C++14.