From f3e6c4e96ac509eb5de045ec3d29833d975eb93a Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 7 May 2006 17:52:38 +0000 Subject: [PATCH] Hash workarounds for Digital Mars. [SVN r33958] --- .../functional/detail/float_functions.hpp | 2 +- include/boost/functional/hash/hash.hpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/boost/functional/detail/float_functions.hpp b/include/boost/functional/detail/float_functions.hpp index c5fc94a..34b8251 100644 --- a/include/boost/functional/detail/float_functions.hpp +++ b/include/boost/functional/detail/float_functions.hpp @@ -25,7 +25,7 @@ // STLport: #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -# if defined(__GNUC__) && __GNUC__ < 3 && (defined(linux) || defined(__linux) || defined(__linux__)) +# if (defined(__GNUC__) && __GNUC__ < 3 && (defined(linux) || defined(__linux) || defined(__linux__))) || defined(__DMC__) # define BOOST_HASH_USE_C99_FLOAT_FUNCS # elif defined(BOOST_MSVC) && BOOST_MSVC < 1300 # define BOOST_HASH_USE_C99_FLOAT_FUNCS diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index b278c9b..c7189c5 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -41,7 +41,11 @@ namespace boost std::size_t hash_value(long); std::size_t hash_value(unsigned long); +#if !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x847)) template std::size_t hash_value(T* const&); +#else + template std::size_t hash_value(T*); +#endif #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) template< class T, unsigned N > @@ -105,7 +109,11 @@ namespace boost } // Implementation by Alberto Barbati and Dave Harris. +#if !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x847)) template std::size_t hash_value(T* const& v) +#else + template std::size_t hash_value(T* v) +#endif { std::size_t x = static_cast( reinterpret_cast(v)); @@ -460,6 +468,17 @@ namespace boost #endif }; +#if BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x847)) + template struct hash + : std::unary_function + { + std::size_t operator()(const T* val) const + { + return boost::hash_range(val, val+n); + } + }; +#endif + #elif !BOOST_WORKAROUND(BOOST_MSVC, < 1300) // On compilers without partial specialization, boost::hash