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
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
00044 {
00045 namespace tr1
00046 {
00047
00048
00049
00050 template<class Key, class T,
00051 class Hash = hash<Key>,
00052 class Pred = std::equal_to<Key>,
00053 class Alloc = std::allocator<std::pair<const Key, T> >,
00054 bool cache_hash_code = false>
00055 class unordered_map
00056 : public hashtable <Key, std::pair<const Key, T>,
00057 Alloc,
00058 Internal::extract1st<std::pair<const Key, T> >, Pred,
00059 Hash, Internal::mod_range_hashing,
00060 Internal::default_ranged_hash,
00061 Internal::prime_rehash_policy,
00062 cache_hash_code, false, true>
00063 {
00064 typedef hashtable <Key, std::pair<const Key, T>,
00065 Alloc,
00066 Internal::extract1st<std::pair<const Key, T> >, Pred,
00067 Hash, Internal::mod_range_hashing,
00068 Internal::default_ranged_hash,
00069 Internal::prime_rehash_policy,
00070 cache_hash_code, false, true>
00071 Base;
00072
00073 public:
00074 typedef typename Base::size_type size_type;
00075 typedef typename Base::hasher hasher;
00076 typedef typename Base::key_equal key_equal;
00077 typedef typename Base::allocator_type allocator_type;
00078
00079 explicit
00080 unordered_map(size_type n = 10,
00081 const hasher& hf = hasher(),
00082 const key_equal& eql = key_equal(),
00083 const allocator_type& a = allocator_type())
00084 : Base(n, hf, Internal::mod_range_hashing(),
00085 Internal::default_ranged_hash(),
00086 eql, Internal::extract1st<std::pair<const Key, T> >(), a)
00087 { }
00088
00089 template<typename InputIterator>
00090 unordered_map(InputIterator f, InputIterator l,
00091 size_type n = 10,
00092 const hasher& hf = hasher(),
00093 const key_equal& eql = key_equal(),
00094 const allocator_type& a = allocator_type())
00095 : Base (f, l, n, hf, Internal::mod_range_hashing(),
00096 Internal::default_ranged_hash(),
00097 eql, Internal::extract1st<std::pair<const Key, T> >(), a)
00098 { }
00099 };
00100
00101 template<class Key, class T,
00102 class Hash = hash<Key>,
00103 class Pred = std::equal_to<Key>,
00104 class Alloc = std::allocator<std::pair<const Key, T> >,
00105 bool cache_hash_code = false>
00106 class unordered_multimap
00107 : public hashtable <Key, std::pair<const Key, T>,
00108 Alloc,
00109 Internal::extract1st<std::pair<const Key, T> >, Pred,
00110 Hash, Internal::mod_range_hashing,
00111 Internal::default_ranged_hash,
00112 Internal::prime_rehash_policy,
00113 cache_hash_code, false, false>
00114 {
00115 typedef hashtable <Key, std::pair<const Key, T>,
00116 Alloc,
00117 Internal::extract1st<std::pair<const Key, T> >, Pred,
00118 Hash, Internal::mod_range_hashing,
00119 Internal::default_ranged_hash,
00120 Internal::prime_rehash_policy,
00121 cache_hash_code, false, false>
00122 Base;
00123
00124 public:
00125 typedef typename Base::size_type size_type;
00126 typedef typename Base::hasher hasher;
00127 typedef typename Base::key_equal key_equal;
00128 typedef typename Base::allocator_type allocator_type;
00129
00130 explicit
00131 unordered_multimap(size_type n = 10,
00132 const hasher& hf = hasher(),
00133 const key_equal& eql = key_equal(),
00134 const allocator_type& a = allocator_type())
00135 : Base (n, hf, Internal::mod_range_hashing(),
00136 Internal::default_ranged_hash(),
00137 eql, Internal::extract1st<std::pair<const Key, T> >(), a)
00138 { }
00139
00140
00141 template<typename InputIterator>
00142 unordered_multimap(InputIterator f, InputIterator l,
00143 typename Base::size_type n = 0,
00144 const hasher& hf = hasher(),
00145 const key_equal& eql = key_equal(),
00146 const allocator_type& a = allocator_type())
00147 : Base (f, l, n, hf, Internal::mod_range_hashing(),
00148 Internal::default_ranged_hash(),
00149 eql, Internal::extract1st<std::pair<const Key, T> >(), a)
00150 { }
00151 };
00152
00153 template<class Key, class T, class Hash, class Pred, class Alloc,
00154 bool cache_hash_code>
00155 inline void
00156 swap(unordered_map<Key, T, Hash, Pred, Alloc, cache_hash_code>& x,
00157 unordered_map<Key, T, Hash, Pred, Alloc, cache_hash_code>& y)
00158 { x.swap(y); }
00159
00160 template<class Key, class T, class Hash, class Pred, class Alloc,
00161 bool cache_hash_code>
00162 inline void
00163 swap(unordered_multimap<Key, T, Hash, Pred, Alloc, cache_hash_code>& x,
00164 unordered_multimap<Key, T, Hash, Pred, Alloc, cache_hash_code>& y)
00165 { x.swap(y); }
00166
00167 }
00168 }
00169
00170 #endif