From fb20d59aa8601c7734cf36f9163d25300cdb0632 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 8 Jun 2006 22:12:16 +0000 Subject: [PATCH] Get hashing std::size_t working on 64-bit Visual C++. [SVN r34253] --- include/boost/functional/hash/hash.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index c1d463e..dbff12b 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -41,6 +41,14 @@ namespace boost std::size_t hash_value(long); std::size_t hash_value(unsigned long); +#if defined(BOOST_MSVC) && defined(_WIN64) + // On 64-bit windows std::size_t is a typedef for unsigned long long, which + // isn't due to be supported until Boost 1.35. So add support here. + // (Technically, Boost.Hash isn't actually documented as supporting + // std::size_t. But it would be pretty silly not to). + std::size_t hash_value(std::size_t); +#endif + #if !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x847)) template std::size_t hash_value(T* const&); #else @@ -108,6 +116,13 @@ namespace boost return static_cast(v); } +#if defined(BOOST_MSVC) && defined(_WIN64) + inline std::size_t hash_value(std::size_t v) + { + return v; + } +#endif + // Implementation by Alberto Barbati and Dave Harris. #if !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x847)) template std::size_t hash_value(T* const& v)