mirror of
https://github.com/boostorg/functional.git
synced 2025-08-02 14:04:27 +02:00
A few more comments in boost::hash.
[SVN r54139]
This commit is contained in:
@@ -17,6 +17,12 @@
|
|||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//
|
||||||
|
// call_hash_impl
|
||||||
|
//
|
||||||
|
|
||||||
|
// On compilers without function template ordering, this deals with arrays.
|
||||||
|
|
||||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||||
namespace hash_detail
|
namespace hash_detail
|
||||||
{
|
{
|
||||||
@@ -61,6 +67,11 @@ namespace boost
|
|||||||
}
|
}
|
||||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
|
||||||
|
//
|
||||||
|
// boost::hash
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||||
|
|
||||||
template <class T> struct hash
|
template <class T> struct hash
|
||||||
@@ -94,7 +105,7 @@ namespace boost
|
|||||||
|
|
||||||
// On compilers without partial specialization, boost::hash<T>
|
// On compilers without partial specialization, boost::hash<T>
|
||||||
// has already been declared to deal with pointers, so just
|
// 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
|
namespace hash_detail
|
||||||
{
|
{
|
||||||
@@ -126,8 +137,8 @@ namespace boost
|
|||||||
|
|
||||||
#else // Visual C++ 6.5
|
#else // Visual C++ 6.5
|
||||||
|
|
||||||
// There's probably a more elegant way to Visual C++ 6.5 to work
|
// Visual C++ 6.5 has problems with nested member functions and
|
||||||
// but I don't know what it is.
|
// applying const to const types in templates. So we get this:
|
||||||
|
|
||||||
template <bool IsConst>
|
template <bool IsConst>
|
||||||
struct hash_impl_msvc
|
struct hash_impl_msvc
|
||||||
|
@@ -379,6 +379,18 @@ namespace boost
|
|||||||
// boost::hash
|
// 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)
|
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
#define BOOST_HASH_SPECIALIZE(type) \
|
#define BOOST_HASH_SPECIALIZE(type) \
|
||||||
template <> struct hash<type> \
|
template <> struct hash<type> \
|
||||||
@@ -465,7 +477,10 @@ namespace boost
|
|||||||
#undef BOOST_HASH_SPECIALIZE
|
#undef BOOST_HASH_SPECIALIZE
|
||||||
#undef BOOST_HASH_SPECIALIZE_REF
|
#undef BOOST_HASH_SPECIALIZE_REF
|
||||||
|
|
||||||
|
// Specializing boost::hash for pointers.
|
||||||
|
|
||||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct hash<T*>
|
struct hash<T*>
|
||||||
: public std::unary_function<T*, std::size_t>
|
: public std::unary_function<T*, std::size_t>
|
||||||
@@ -482,7 +497,15 @@ namespace boost
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#else
|
#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
|
namespace hash_detail
|
||||||
{
|
{
|
||||||
template <bool IsPointer>
|
template <bool IsPointer>
|
||||||
@@ -515,6 +538,7 @@ namespace boost
|
|||||||
::BOOST_NESTED_TEMPLATE inner<T>
|
::BOOST_NESTED_TEMPLATE inner<T>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user