89 #define IS_HASHABLE(type) static_assert(is_hashable<type>::value, "Type " #type " is not hashable, but should be") 90 #define IS_NOT_HASHABLE(type) static_assert(!is_hashable<type>::value, "Type " #type " is hashable, but shouldn't be") 163 static_assert(
is_hashable<std::pair<int, int>>::value,
"Failed test for pair");
164 static_assert(
is_hashable<std::pair<const char, float>>::value,
"Failed test for pair");
165 static_assert(
is_hashable<std::pair<unsigned long, short>>::value,
"Failed test for pair");
166 static_assert(!
is_hashable<std::pair<HashMember_BadSig0, int>>::value,
"Test");
194 HashMember hm{123,
"This is a test string\n"};
195 HashFree hf{123,
"This is a test string\n"};
205 std::cout <<
" Hash of HashMember class: " <<
hash_to_string(hm_val) <<
"\n";
206 std::cout <<
" Hash of HashFree class: " <<
hash_to_string(hf_val) <<
"\n";
207 std::cout <<
" Hash of HashFreeTemplate<int> class: " <<
hash_to_string(hfti_val) <<
"\n";
208 std::cout <<
" Hash of HashFreeTemplate<string> class: " <<
hash_to_string(hfts_val) <<
"\n";
209 std::cout <<
" (they aren't supposed to be the same)\n";
#define IS_NOT_HASHABLE(type)
Trait class that determines if a type is hashable or not.
std::string hash_to_string(const HashValue &hash)
Return a string representation of a hash.
std::enable_if< is_hashable< T >::value, void >::type hash_object(const std::array< T, N > &a, Hasher &h)
Hashing of std::array.
A class that hashes objects (header)
void hash(Hasher &&) const
HashValue make_hash(HashType type, const Targs &...objs)
Convenience function for hashing objects in a single function call.
HashType
Type of hash to use.
void hash(Hasher &h) const
Class that is used to hash objects.
std::vector< uint8_t > HashValue
Stores the value of a hash.
void hash(const Hasher &) const
A convenience header that includes all the types supported by bphash.
#define IS_HASHABLE(type)