| 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_SET_HPP) | 
|---|
| 12 | #define BOOST_FUNCTIONAL_HASH_SET_HPP | 
|---|
| 13 |  | 
|---|
| 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) | 
|---|
| 15 | # pragma once | 
|---|
| 16 | #endif | 
|---|
| 17 |  | 
|---|
| 18 | #include <boost/config.hpp> | 
|---|
| 19 | #include <set> | 
|---|
| 20 | #include <boost/functional/hash/hash.hpp> | 
|---|
| 21 |  | 
|---|
| 22 | namespace boost | 
|---|
| 23 | { | 
|---|
| 24 |     template <class K, class C, class A> | 
|---|
| 25 |     std::size_t hash_value(std::set<K, C, A> const& v) | 
|---|
| 26 |     { | 
|---|
| 27 |         return hash_range(v.begin(), v.end()); | 
|---|
| 28 |     } | 
|---|
| 29 |  | 
|---|
| 30 |     template <class K, class C, class A> | 
|---|
| 31 |     std::size_t hash_value(std::multiset<K, C, A> const& v) | 
|---|
| 32 |     { | 
|---|
| 33 |         return hash_range(v.begin(), v.end()); | 
|---|
| 34 |     } | 
|---|
| 35 |  | 
|---|
| 36 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) | 
|---|
| 37 |     namespace hash_detail | 
|---|
| 38 |     { | 
|---|
| 39 |         template <class K, class C, class A> | 
|---|
| 40 |         struct call_hash<std::set<K, C, A> > | 
|---|
| 41 |         { | 
|---|
| 42 |             static std::size_t call(std::set<K, C, A> const& val) | 
|---|
| 43 |             { | 
|---|
| 44 |                 return boost::hash_value(val); | 
|---|
| 45 |             } | 
|---|
| 46 |         }; | 
|---|
| 47 |  | 
|---|
| 48 |         template <class K, class C, class A> | 
|---|
| 49 |         struct call_hash<std::multiset<K, C, A> > | 
|---|
| 50 |         { | 
|---|
| 51 |             static std::size_t call(std::multiset<K, C, A> const& val) | 
|---|
| 52 |             { | 
|---|
| 53 |                 return boost::hash_value(val); | 
|---|
| 54 |             } | 
|---|
| 55 |         }; | 
|---|
| 56 |     } | 
|---|
| 57 | #endif | 
|---|
| 58 | } | 
|---|
| 59 |  | 
|---|
| 60 | #endif | 
|---|
| 61 |  | 
|---|