diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/functional/hash/extensions.hpp | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-contrib-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-contrib-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/functional/hash/extensions.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/functional/hash/extensions.hpp | 110 |
1 files changed, 107 insertions, 3 deletions
diff --git a/3rdParty/Boost/src/boost/functional/hash/extensions.hpp b/3rdParty/Boost/src/boost/functional/hash/extensions.hpp index d173314..3c587a3 100644 --- a/3rdParty/Boost/src/boost/functional/hash/extensions.hpp +++ b/3rdParty/Boost/src/boost/functional/hash/extensions.hpp @@ -7,15 +7,114 @@ // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf // issue 6.18. +// This implements the extensions to the standard. +// It's undocumented, so you shouldn't use it.... + #if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) #define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP +#include <boost/functional/hash/hash.hpp> +#include <boost/detail/container_fwd.hpp> + #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +#include <boost/type_traits/is_array.hpp> +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +#include <boost/type_traits/is_const.hpp> +#endif + namespace boost { + template <class A, class B> + std::size_t hash_value(std::pair<A, B> const&); + template <class T, class A> + std::size_t hash_value(std::vector<T, A> const&); + template <class T, class A> + std::size_t hash_value(std::list<T, A> const& v); + template <class T, class A> + std::size_t hash_value(std::deque<T, A> const& v); + template <class K, class C, class A> + std::size_t hash_value(std::set<K, C, A> const& v); + template <class K, class C, class A> + std::size_t hash_value(std::multiset<K, C, A> const& v); + template <class K, class T, class C, class A> + std::size_t hash_value(std::map<K, T, C, A> const& v); + template <class K, class T, class C, class A> + std::size_t hash_value(std::multimap<K, T, C, A> const& v); + + template <class T> + std::size_t hash_value(std::complex<T> const&); + + template <class A, class B> + std::size_t hash_value(std::pair<A, B> const& v) + { + std::size_t seed = 0; + hash_combine(seed, v.first); + hash_combine(seed, v.second); + return seed; + } + + template <class T, class A> + std::size_t hash_value(std::vector<T, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class T, class A> + std::size_t hash_value(std::list<T, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class T, class A> + std::size_t hash_value(std::deque<T, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class K, class C, class A> + std::size_t hash_value(std::set<K, C, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class K, class C, class A> + std::size_t hash_value(std::multiset<K, C, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class K, class T, class C, class A> + std::size_t hash_value(std::map<K, T, C, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class K, class T, class C, class A> + std::size_t hash_value(std::multimap<K, T, C, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class T> + std::size_t hash_value(std::complex<T> const& v) + { + boost::hash<T> hasher; + std::size_t seed = hasher(v.imag()); + seed ^= hasher(v.real()) + (seed<<6) + (seed>>2); + return seed; + } + + // + // 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 +160,11 @@ namespace boost } #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + // + // boost::hash + // + + #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template <class T> struct hash @@ -94,7 +198,7 @@ namespace boost // 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 +230,8 @@ namespace boost #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 |