mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
add polymorphic hash functor
This commit is contained in:
parent
70b94395d5
commit
3ab397171f
1 changed files with 14 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/functional/hash/hash_fwd.hpp>
|
||||
#include <sprout/functional/hash/to_hash.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -32,6 +33,19 @@ namespace sprout {
|
|||
struct hash<T const volatile>
|
||||
: public sprout::hash<T>
|
||||
{};
|
||||
template<>
|
||||
struct hash<void> {
|
||||
public:
|
||||
typedef std::size_t result_type;
|
||||
public:
|
||||
template<typename T>
|
||||
SPROUT_CONSTEXPR std::size_t
|
||||
operator()(T&& v)
|
||||
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::to_hash(sprout::forward<T>(v))))
|
||||
{
|
||||
return sprout::to_hash(sprout::forward<T>(v));
|
||||
}
|
||||
};
|
||||
|
||||
#define SPROUT_HASH_SPECIALIZE(type) \
|
||||
template<> \
|
||||
|
|
Loading…
Reference in a new issue