00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef GNU_LIBSTDCXX_TR1_UNORDERED_MAP_
00035 #define GNU_LIBSTDCXX_TR1_UNORDERED_MAP_
00036
00037 #include <tr1/hashtable>
00038 #include <tr1/functional>
00039 #include <tr1/functional>
00040 #include <utility>
00041 #include <memory>
00042
00043 namespace std { namespace tr1 {
00044
00045
00046
00047 template <class Key, class T,
00048 class Hash = hash<Key>,
00049 class Pred = std::equal_to<Key>,
00050 class Alloc = std::allocator<std::pair<const Key, T> >,
00051 bool cache_hash_code = false>
00052 class unordered_map
00053 : public hashtable <Key, std::pair<const Key, T>,
00054 Alloc,
00055 Internal::extract1st<std::pair<const Key, T> >, Pred,
00056 Hash, Internal::mod_range_hashing, Internal::default_ranged_hash,
00057 Internal::prime_rehash_policy,
00058 cache_hash_code, true, true>
00059 {
00060 typedef hashtable <Key, std::pair<const Key, T>,
00061 Alloc,
00062 Internal::extract1st<std::pair<const Key, T> >, Pred,
00063 Hash, Internal::mod_range_hashing, Internal::default_ranged_hash,
00064 Internal::prime_rehash_policy,
00065 cache_hash_code, true, true>
00066 Base;
00067
00068 public:
00069 typedef typename Base::size_type size_type;
00070 typedef typename Base::hasher hasher;
00071 typedef typename Base::key_equal key_equal;
00072 typedef typename Base::allocator_type allocator_type;
00073
00074 explicit unordered_map(size_type n = 10,
00075 const hasher& hf = hasher(),
00076 const key_equal& eql = key_equal(),
00077 const allocator_type& a = allocator_type())
00078 : Base (n,
00079 hf, Internal::mod_range_hashing(), Internal::default_ranged_hash(),
00080 eql, Internal::extract1st<std::pair<const Key, T> >(),
00081 a)
00082 { }
00083
00084 template <typename InputIterator>
00085 unordered_map(InputIterator f, InputIterator l,
00086 size_type n = 10,
00087 const hasher& hf = hasher(),
00088 const key_equal& eql = key_equal(),
00089 const allocator_type& a = allocator_type())
00090 : Base (f, l,
00091 n,
00092 hf, Internal::mod_range_hashing(), Internal::default_ranged_hash(),
00093 eql, Internal::extract1st<std::pair<const Key, T> >(),
00094 a)
00095 { }
00096 };
00097
00098 template <class Key, class T,
00099 class Hash = hash<Key>,
00100 class Pred = std::equal_to<Key>,
00101 class Alloc = std::allocator<std::pair<const Key, T> >,
00102 bool cache_hash_code = false>
00103 class unordered_multimap
00104 : public hashtable <Key, std::pair<const Key, T>,
00105 Alloc,
00106 Internal::extract1st<std::pair<const Key, T> >, Pred,
00107 Hash, Internal::mod_range_hashing, Internal::default_ranged_hash,
00108 Internal::prime_rehash_policy,
00109 cache_hash_code, true, false>
00110 {
00111 typedef hashtable <Key, std::pair<const Key, T>,
00112 Alloc,
00113 Internal::extract1st<std::pair<const Key, T> >, Pred,
00114 Hash, Internal::mod_range_hashing, Internal::default_ranged_hash,
00115 Internal::prime_rehash_policy,
00116 cache_hash_code, true, false>
00117 Base;
00118
00119 public:
00120 typedef typename Base::size_type size_type;
00121 typedef typename Base::hasher hasher;
00122 typedef typename Base::key_equal key_equal;
00123 typedef typename Base::allocator_type allocator_type;
00124
00125 explicit unordered_multimap(size_type n = 10,
00126 const hasher& hf = hasher(),
00127 const key_equal& eql = key_equal(),
00128 const allocator_type& a = allocator_type())
00129 : Base (n,
00130 hf, Internal::mod_range_hashing(), Internal::default_ranged_hash(),
00131 eql, Internal::extract1st<std::pair<const Key, T> >(),
00132 a)
00133 { }
00134
00135
00136 template <typename InputIterator>
00137 unordered_multimap(InputIterator f, InputIterator l,
00138 typename Base::size_type n = 0,
00139 const hasher& hf = hasher(),
00140 const key_equal& eql = key_equal(),
00141 const allocator_type& a = allocator_type())
00142 : Base (f, l,
00143 n,
00144 hf, Internal::mod_range_hashing(), Internal::default_ranged_hash(),
00145 eql, Internal::extract1st<std::pair<const Key, T> >(),
00146 a)
00147 { }
00148 };
00149
00150 template <class Key, class T, class Hash, class Pred, class Alloc, bool cache_hash_code>
00151 inline void swap (unordered_map<Key, T, Hash, Pred, Alloc, cache_hash_code>& x,
00152 unordered_map<Key, T, Hash, Pred, Alloc, cache_hash_code>& y)
00153 {
00154 x.swap(y);
00155 }
00156
00157 template <class Key, class T, class Hash, class Pred, class Alloc, bool cache_hash_code>
00158 inline void swap (unordered_multimap<Key, T, Hash, Pred, Alloc, cache_hash_code>& x,
00159 unordered_multimap<Key, T, Hash, Pred, Alloc, cache_hash_code>& y)
00160 {
00161 x.swap(y);
00162 }
00163
00164 } }
00165
00166 #endif