mirror of
https://github.com/boostorg/functional.git
synced 2025-08-01 21:44:28 +02:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
@@ -41,10 +41,6 @@
|
|||||||
#include <boost/type_traits/is_array.hpp>
|
#include <boost/type_traits/is_array.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
|
||||||
#include <boost/type_traits/is_const.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
template <class A, class B>
|
template <class A, class B>
|
||||||
@@ -233,11 +229,7 @@ namespace boost
|
|||||||
template <class Array>
|
template <class Array>
|
||||||
struct inner
|
struct inner
|
||||||
{
|
{
|
||||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
|
||||||
static std::size_t call(Array const& v)
|
static std::size_t call(Array const& v)
|
||||||
#else
|
|
||||||
static std::size_t call(Array& v)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
const int size = sizeof(v) / sizeof(*v);
|
const int size = sizeof(v) / sizeof(*v);
|
||||||
return boost::hash_range(v, v + size);
|
return boost::hash_range(v, v + size);
|
||||||
@@ -299,8 +291,6 @@ namespace boost
|
|||||||
template <bool IsPointer>
|
template <bool IsPointer>
|
||||||
struct hash_impl;
|
struct hash_impl;
|
||||||
|
|
||||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash_impl<false>
|
struct hash_impl<false>
|
||||||
{
|
{
|
||||||
@@ -321,58 +311,6 @@ namespace boost
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#else // Visual C++ 6.5
|
|
||||||
|
|
||||||
// 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
|
|
||||||
{
|
|
||||||
template <class T>
|
|
||||||
struct inner
|
|
||||||
: public std::unary_function<T, std::size_t>
|
|
||||||
{
|
|
||||||
std::size_t operator()(T const& val) const
|
|
||||||
{
|
|
||||||
return hash_detail::call_hash<T const>::call(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t operator()(T& val) const
|
|
||||||
{
|
|
||||||
return hash_detail::call_hash<T>::call(val);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct hash_impl_msvc<true>
|
|
||||||
{
|
|
||||||
template <class T>
|
|
||||||
struct inner
|
|
||||||
: public std::unary_function<T, std::size_t>
|
|
||||||
{
|
|
||||||
std::size_t operator()(T& val) const
|
|
||||||
{
|
|
||||||
return hash_detail::call_hash<T>::call(val);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
struct hash_impl_msvc2
|
|
||||||
: public hash_impl_msvc<boost::is_const<T>::value>
|
|
||||||
::BOOST_NESTED_TEMPLATE inner<T> {};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct hash_impl<false>
|
|
||||||
{
|
|
||||||
template <class T>
|
|
||||||
struct inner : public hash_impl_msvc2<T> {};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // Visual C++ 6.5
|
|
||||||
}
|
}
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
}
|
}
|
||||||
|
@@ -248,13 +248,8 @@ namespace boost
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
|
||||||
template <class T>
|
|
||||||
inline void hash_combine(std::size_t& seed, T& v)
|
|
||||||
#else
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void hash_combine(std::size_t& seed, T const& v)
|
inline void hash_combine(std::size_t& seed, T const& v)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
boost::hash<T> hasher;
|
boost::hash<T> hasher;
|
||||||
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||||
@@ -362,7 +357,6 @@ namespace boost
|
|||||||
//
|
//
|
||||||
// These are undefined later.
|
// These are undefined later.
|
||||||
|
|
||||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
|
||||||
#define BOOST_HASH_SPECIALIZE(type) \
|
#define BOOST_HASH_SPECIALIZE(type) \
|
||||||
template <> struct hash<type> \
|
template <> struct hash<type> \
|
||||||
: public std::unary_function<type, std::size_t> \
|
: public std::unary_function<type, std::size_t> \
|
||||||
@@ -382,45 +376,6 @@ namespace boost
|
|||||||
return boost::hash_value(v); \
|
return boost::hash_value(v); \
|
||||||
} \
|
} \
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
#define BOOST_HASH_SPECIALIZE(type) \
|
|
||||||
template <> struct hash<type> \
|
|
||||||
: public std::unary_function<type, std::size_t> \
|
|
||||||
{ \
|
|
||||||
std::size_t operator()(type v) const \
|
|
||||||
{ \
|
|
||||||
return boost::hash_value(v); \
|
|
||||||
} \
|
|
||||||
}; \
|
|
||||||
\
|
|
||||||
template <> struct hash<const type> \
|
|
||||||
: public std::unary_function<const type, std::size_t> \
|
|
||||||
{ \
|
|
||||||
std::size_t operator()(const type v) const \
|
|
||||||
{ \
|
|
||||||
return boost::hash_value(v); \
|
|
||||||
} \
|
|
||||||
};
|
|
||||||
|
|
||||||
#define BOOST_HASH_SPECIALIZE_REF(type) \
|
|
||||||
template <> struct hash<type> \
|
|
||||||
: public std::unary_function<type, std::size_t> \
|
|
||||||
{ \
|
|
||||||
std::size_t operator()(type const& v) const \
|
|
||||||
{ \
|
|
||||||
return boost::hash_value(v); \
|
|
||||||
} \
|
|
||||||
}; \
|
|
||||||
\
|
|
||||||
template <> struct hash<const type> \
|
|
||||||
: public std::unary_function<const type, std::size_t> \
|
|
||||||
{ \
|
|
||||||
std::size_t operator()(type const& v) const \
|
|
||||||
{ \
|
|
||||||
return boost::hash_value(v); \
|
|
||||||
} \
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOST_HASH_SPECIALIZE(bool)
|
BOOST_HASH_SPECIALIZE(bool)
|
||||||
BOOST_HASH_SPECIALIZE(char)
|
BOOST_HASH_SPECIALIZE(char)
|
||||||
|
@@ -22,11 +22,7 @@ namespace boost
|
|||||||
{
|
{
|
||||||
template <class T> struct hash;
|
template <class T> struct hash;
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
|
||||||
template <class T> void hash_combine(std::size_t& seed, T& v);
|
|
||||||
#else
|
|
||||||
template <class T> void hash_combine(std::size_t& seed, T const& v);
|
template <class T> void hash_combine(std::size_t& seed, T const& v);
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class It> std::size_t hash_range(It, It);
|
template <class It> std::size_t hash_range(It, It);
|
||||||
template <class It> void hash_range(std::size_t&, It, It);
|
template <class It> void hash_range(std::size_t&, It, It);
|
||||||
|
Reference in New Issue
Block a user