Boost logo

Boost-Commit :

From: None_at_[hidden]
Date: 2007-08-10 06:32:21


Author: None
Date: 2007-08-10 06:32:21 EDT (Fri, 10 Aug 2007)
New Revision: 38563
URL: http://svn.boost.org/trac/boost/changeset/38563

Log:
Add overloads of hash_value for more built in types. They're not strictly
needed and aren't in the original specifiction but they avoid a warning. See
ticket #1095 for details.

Text files modified:
   trunk/boost/functional/hash/hash.hpp | 48 ++++++++++++++++++++++++++++++++++-----
   trunk/libs/functional/hash/doc/ref.xml | 30 +++++++++++++++++++++++++
   2 files changed, 71 insertions(+), 7 deletions(-)

Modified: trunk/boost/functional/hash/hash.hpp
==============================================================================
--- trunk/boost/functional/hash/hash.hpp (original)
+++ trunk/boost/functional/hash/hash.hpp 2007-08-10 06:32:21 EDT (Fri, 10 Aug 2007)
@@ -34,17 +34,21 @@
 
 namespace boost
 {
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
- // Borland complains about an ambiguous function overload
- // when compiling boost::hash<bool>.
     std::size_t hash_value(bool);
-#endif
-
+ std::size_t hash_value(char);
+ std::size_t hash_value(unsigned char);
+ std::size_t hash_value(signed char);
+ std::size_t hash_value(short);
+ std::size_t hash_value(unsigned short);
     std::size_t hash_value(int);
     std::size_t hash_value(unsigned int);
     std::size_t hash_value(long);
     std::size_t hash_value(unsigned long);
 
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+ std::size_t hash_value(wchar_t);
+#endif
+
 #if defined(BOOST_HAS_LONG_LONG)
     std::size_t hash_value(long long);
     std::size_t hash_value(unsigned long long);
@@ -137,12 +141,35 @@
         }
     }
 
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
     inline std::size_t hash_value(bool v)
     {
         return static_cast<std::size_t>(v);
     }
-#endif
+
+ inline std::size_t hash_value(char v)
+ {
+ return static_cast<std::size_t>(v);
+ }
+
+ std::size_t hash_value(unsigned char v)
+ {
+ return static_cast<std::size_t>(v);
+ }
+
+ std::size_t hash_value(signed char v)
+ {
+ return static_cast<std::size_t>(v);
+ }
+
+ inline std::size_t hash_value(short v)
+ {
+ return static_cast<std::size_t>(v);
+ }
+
+ inline std::size_t hash_value(unsigned short v)
+ {
+ return static_cast<std::size_t>(v);
+ }
 
     inline std::size_t hash_value(int v)
     {
@@ -164,6 +191,13 @@
         return static_cast<std::size_t>(v);
     }
 
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+ std::size_t hash_value(wchar_t v)
+ {
+ return static_cast<std::size_t>(v);
+ }
+#endif
+
 #if defined(BOOST_HAS_LONG_LONG)
     inline std::size_t hash_value(long long v)
     {

Modified: trunk/libs/functional/hash/doc/ref.xml
==============================================================================
--- trunk/libs/functional/hash/doc/ref.xml (original)
+++ trunk/libs/functional/hash/doc/ref.xml 2007-08-10 06:32:21 EDT (Fri, 10 Aug 2007)
@@ -517,6 +517,36 @@
 
         <signature>
           <type>std::size_t</type>
+ <parameter name="val"><paramtype>bool</paramtype></parameter>
+ </signature>
+
+ <signature>
+ <type>std::size_t</type>
+ <parameter name="val"><paramtype>char</paramtype></parameter>
+ </signature>
+
+ <signature>
+ <type>std::size_t</type>
+ <parameter name="val"><paramtype>signed char</paramtype></parameter>
+ </signature>
+
+ <signature>
+ <type>std::size_t</type>
+ <parameter name="val"><paramtype>unsigned char</paramtype></parameter>
+ </signature>
+
+ <signature>
+ <type>std::size_t</type>
+ <parameter name="val"><paramtype>short</paramtype></parameter>
+ </signature>
+
+ <signature>
+ <type>std::size_t</type>
+ <parameter name="val"><paramtype>unsigned short</paramtype></parameter>
+ </signature>
+
+ <signature>
+ <type>std::size_t</type>
           <parameter name="val"><paramtype>int</paramtype></parameter>
         </signature>
 


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