mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
hash: use std::hash for string hashing
This commit is contained in:
parent
25170b32eb
commit
fe31b387e8
@ -35,6 +35,7 @@
|
|||||||
#define UTIL_HASH_H
|
#define UTIL_HASH_H
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -123,9 +124,15 @@ struct ue2_hash<T, typename std::enable_if<has_hash_member<T>::value>::type> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Hash for any container type that supports std::begin(). */
|
/**
|
||||||
|
* \brief Hash for any container type that supports std::begin().
|
||||||
|
*
|
||||||
|
* We exempt std::string as std::hash<std:string> is provided and quicker.
|
||||||
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct ue2_hash<T, typename std::enable_if<is_container<T>::value &&
|
struct ue2_hash<T, typename std::enable_if<
|
||||||
|
is_container<T>::value &&
|
||||||
|
!std::is_same<typename std::decay<T>::type, std::string>::value &&
|
||||||
!has_hash_member<T>::value>::type> {
|
!has_hash_member<T>::value>::type> {
|
||||||
size_t operator()(const T &obj) const {
|
size_t operator()(const T &obj) const {
|
||||||
size_t v = 0;
|
size_t v = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user