Rev | Line | |
---|
[857] | 1 |
|
---|
| 2 | // (C) Copyright Daniel James 2005.
|
---|
| 3 | // Use, modification and distribution are subject to the
|
---|
| 4 | // Boost Software License, Version 1.0. (See accompanying file
|
---|
| 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 6 | //
|
---|
| 7 | // Based on Peter Dimov's proposal
|
---|
| 8 | // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
|
---|
| 9 | // issue 6.18.
|
---|
| 10 |
|
---|
| 11 | #if !defined(BOOST_FUNCTIONAL_HASH_PAIR_HPP)
|
---|
| 12 | #define BOOST_FUNCTIONAL_HASH_PAIR_HPP
|
---|
| 13 |
|
---|
| 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
---|
| 15 | # pragma once
|
---|
| 16 | #endif
|
---|
| 17 |
|
---|
| 18 | #include <boost/config.hpp>
|
---|
| 19 | #include <utility>
|
---|
| 20 | #include <boost/functional/hash/hash.hpp>
|
---|
| 21 |
|
---|
| 22 | namespace boost
|
---|
| 23 | {
|
---|
| 24 | template <class A, class B>
|
---|
| 25 | std::size_t hash_value(std::pair<A, B> const& v)
|
---|
| 26 | {
|
---|
| 27 | std::size_t seed = 0;
|
---|
| 28 | hash_combine(seed, v.first);
|
---|
| 29 | hash_combine(seed, v.second);
|
---|
| 30 | return seed;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
---|
| 34 | namespace hash_detail
|
---|
| 35 | {
|
---|
| 36 | template <class A, class B>
|
---|
| 37 | struct call_hash<std::pair<A, B> >
|
---|
| 38 | {
|
---|
| 39 | static std::size_t call(std::pair<A, B> const& val)
|
---|
| 40 | {
|
---|
| 41 | return boost::hash_value(val);
|
---|
| 42 | }
|
---|
| 43 | };
|
---|
| 44 | }
|
---|
| 45 | #endif
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | #endif
|
---|
Note: See
TracBrowser
for help on using the repository browser.