Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81816 - in trunk: boost/functional/hash libs/functional/hash/test
From: dnljms_at_[hidden]
Date: 2012-12-10 05:40:45


Author: danieljames
Date: 2012-12-10 05:40:44 EST (Mon, 10 Dec 2012)
New Revision: 81816
URL: http://svn.boost.org/trac/boost/changeset/81816

Log:
Hash: Support boost::int128_type.
Text files modified:
   trunk/boost/functional/hash/hash.hpp | 20 ++++++++++++++++++--
   trunk/libs/functional/hash/test/hash_number_test.cpp | 5 +++++
   2 files changed, 23 insertions(+), 2 deletions(-)

Modified: trunk/boost/functional/hash/hash.hpp
==============================================================================
--- trunk/boost/functional/hash/hash.hpp (original)
+++ trunk/boost/functional/hash/hash.hpp 2012-12-10 05:40:44 EST (Mon, 10 Dec 2012)
@@ -16,6 +16,7 @@
 #include <string>
 #include <boost/limits.hpp>
 #include <boost/type_traits/is_enum.hpp>
+#include <boost/type_traits/is_integral.hpp>
 #include <boost/utility/enable_if.hpp>
 
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
@@ -40,8 +41,8 @@
         struct enable_hash_value { typedef std::size_t type; };
 
         template <typename T> struct basic_numbers {};
- template <typename T> struct long_numbers {};
- template <typename T> struct ulong_numbers {};
+ template <typename T> struct long_numbers;
+ template <typename T> struct ulong_numbers;
         template <typename T> struct float_numbers {};
 
         template <> struct basic_numbers<bool> :
@@ -70,6 +71,14 @@
             boost::hash_detail::enable_hash_value {};
 #endif
 
+ // long_numbers is defined like this to allow for separate
+ // specialization for long_long and int128_type, in case
+ // they conflict.
+ template <typename T> struct long_numbers2 {};
+ template <typename T> struct ulong_numbers2 {};
+ template <typename T> struct long_numbers : long_numbers2<T> {};
+ template <typename T> struct ulong_numbers : long_numbers2<T> {};
+
 #if !defined(BOOST_NO_LONG_LONG)
         template <> struct long_numbers<boost::long_long_type> :
             boost::hash_detail::enable_hash_value {};
@@ -77,6 +86,13 @@
             boost::hash_detail::enable_hash_value {};
 #endif
 
+#if defined(BOOST_HAS_INT128)
+ template <> struct long_numbers2<boost::int128_type> :
+ boost::hash_detail::enable_hash_value {};
+ template <> struct ulong_numbers2<boost::uint128_type> :
+ boost::hash_detail::enable_hash_value {};
+#endif
+
         template <> struct float_numbers<float> :
             boost::hash_detail::enable_hash_value {};
         template <> struct float_numbers<double> :

Modified: trunk/libs/functional/hash/test/hash_number_test.cpp
==============================================================================
--- trunk/libs/functional/hash/test/hash_number_test.cpp (original)
+++ trunk/libs/functional/hash/test/hash_number_test.cpp 2012-12-10 05:40:44 EST (Mon, 10 Dec 2012)
@@ -175,6 +175,11 @@
     NUMERIC_TEST_NO_LIMITS(boost::ulong_long_type, ulong_long)
 #endif
 
+#if defined(BOOST_HAS_INT128)
+ NUMERIC_TEST_NO_LIMITS(boost::int128_type, int128)
+ NUMERIC_TEST_NO_LIMITS(boost::uint128_type, uint128)
+#endif
+
     NUMERIC_TEST(float, float)
     NUMERIC_TEST(double, double)
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk