|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54139 - trunk/boost/functional/hash
From: daniel_james_at_[hidden]
Date: 2009-06-21 05:41:12
Author: danieljames
Date: 2009-06-21 05:41:11 EDT (Sun, 21 Jun 2009)
New Revision: 54139
URL: http://svn.boost.org/trac/boost/changeset/54139
Log:
A few more comments in boost::hash.
Text files modified:
trunk/boost/functional/hash/extensions.hpp | 17 ++++++++++++++---
trunk/boost/functional/hash/hash.hpp | 24 ++++++++++++++++++++++++
2 files changed, 38 insertions(+), 3 deletions(-)
Modified: trunk/boost/functional/hash/extensions.hpp
==============================================================================
--- trunk/boost/functional/hash/extensions.hpp (original)
+++ trunk/boost/functional/hash/extensions.hpp 2009-06-21 05:41:11 EDT (Sun, 21 Jun 2009)
@@ -17,6 +17,12 @@
namespace boost
{
+ //
+ // call_hash_impl
+ //
+
+ // On compilers without function template ordering, this deals with arrays.
+
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
namespace hash_detail
{
@@ -61,6 +67,11 @@
}
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+ //
+ // boost::hash
+ //
+
+
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template <class T> struct hash
@@ -94,7 +105,7 @@
// On compilers without partial specialization, boost::hash<T>
// has already been declared to deal with pointers, so just
- // need to supply the non-pointer version.
+ // need to supply the non-pointer version of hash_impl.
namespace hash_detail
{
@@ -126,8 +137,8 @@
#else // Visual C++ 6.5
- // There's probably a more elegant way to Visual C++ 6.5 to work
- // but I don't know what it is.
+ // Visual C++ 6.5 has problems with nested member functions and
+ // applying const to const types in templates. So we get this:
template <bool IsConst>
struct hash_impl_msvc
Modified: trunk/boost/functional/hash/hash.hpp
==============================================================================
--- trunk/boost/functional/hash/hash.hpp (original)
+++ trunk/boost/functional/hash/hash.hpp 2009-06-21 05:41:11 EDT (Sun, 21 Jun 2009)
@@ -378,6 +378,18 @@
//
// boost::hash
//
+
+ // Define the specializations required by the standard. The general purpose
+ // boost::hash is defined later in extensions.hpp if BOOST_HASH_NO_EXTENSIONS
+ // is not defined.
+
+ // BOOST_HASH_SPECIALIZE - define a specialization for a type which is
+ // passed by copy.
+ //
+ // BOOST_HASH_SPECIALIZE_REF - define a specialization for a type which is
+ // passed by copy.
+ //
+ // These are undefined later.
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
#define BOOST_HASH_SPECIALIZE(type) \
@@ -465,7 +477,10 @@
#undef BOOST_HASH_SPECIALIZE
#undef BOOST_HASH_SPECIALIZE_REF
+// Specializing boost::hash for pointers.
+
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+
template <class T>
struct hash<T*>
: public std::unary_function<T*, std::size_t>
@@ -482,7 +497,15 @@
#endif
}
};
+
#else
+
+ // For compilers without partial specialization, we define a
+ // boost::hash for all remaining types. But hash_impl is only defined
+ // for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS
+ // is defined there will still be a compile error for types not supported
+ // in the standard.
+
namespace hash_detail
{
template <bool IsPointer>
@@ -515,6 +538,7 @@
::BOOST_NESTED_TEMPLATE inner<T>
{
};
+
#endif
}
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