source: NonGTP/Boost/boost/functional/hash/map.hpp @ 857

Revision 857, 1.7 KB checked in by igarcia, 19 years ago (diff)
Line 
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_MAP_HPP)
12#define BOOST_FUNCTIONAL_HASH_MAP_HPP
13
14#if defined(_MSC_VER) && (_MSC_VER >= 1020)
15# pragma once
16#endif
17
18#include <boost/config.hpp>
19#include <map>
20#include <boost/functional/hash/hash.hpp>
21#include <boost/functional/hash/pair.hpp>
22
23namespace boost
24{
25    template <class K, class T, class C, class A>
26    std::size_t hash_value(std::map<K, T, C, A> const& v)
27    {
28        return hash_range(v.begin(), v.end());
29    }
30
31    template <class K, class T, class C, class A>
32    std::size_t hash_value(std::multimap<K, T, C, A> const& v)
33    {
34        return hash_range(v.begin(), v.end());
35    }
36
37#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
38    namespace hash_detail
39    {
40        template <class K, class T, class C, class A>
41        struct call_hash<std::map<K, T, C, A> >
42        {
43            static std::size_t call(std::map<K, T, C, A> const& val)
44            {
45                return boost::hash_value(val);
46            }
47        };
48
49        template <class K, class T, class C, class A>
50        struct call_hash<std::multimap<K, T, C, A> >
51        {
52            static std::size_t call(std::multimap<K, T, C, A> const& val)
53            {
54                return boost::hash_value(val);
55            }
56        };
57    }
58#endif
59}
60
61#endif
62
63
Note: See TracBrowser for help on using the repository browser.