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_SET_
00035 #define GNU_LIBSTDCXX_TR1_UNORDERED_SET_
00036
00037 #include <tr1/hashtable>
00038 #include <tr1/functional>
00039 #include <memory>
00040
00041 namespace std
00042 {
00043 namespace tr1
00044 {
00045
00046
00047
00048
00049 template<class Value,
00050 class Hash = hash<Value>,
00051 class Pred = std::equal_to<Value>,
00052 class Alloc = std::allocator<Value>,
00053 bool cache_hash_code = false>
00054 class unordered_set
00055 : public hashtable<Value, Value, Alloc,
00056 Internal::identity<Value>, Pred,
00057 Hash, Internal::mod_range_hashing,
00058 Internal::default_ranged_hash,
00059 Internal::prime_rehash_policy,
00060 cache_hash_code, true, true>
00061 {
00062 typedef hashtable<Value, Value, Alloc,
00063 Internal::identity<Value>, Pred,
00064 Hash, Internal::mod_range_hashing,
00065 Internal::default_ranged_hash,
00066 Internal::prime_rehash_policy,
00067 cache_hash_code, true, true>
00068 Base;
00069
00070 public:
00071 typedef typename Base::size_type size_type;
00072 typedef typename Base::hasher hasher;
00073 typedef typename Base::key_equal key_equal;
00074 typedef typename Base::allocator_type allocator_type;
00075
00076 explicit
00077 unordered_set(size_type n = 10,
00078 const hasher& hf = hasher(),
00079 const key_equal& eql = key_equal(),
00080 const allocator_type& a = allocator_type())
00081 : Base (n, hf, Internal::mod_range_hashing(),
00082 Internal::default_ranged_hash(),
00083 eql, Internal::identity<Value>(), a)
00084 { }
00085
00086 template<typename InputIterator>
00087 unordered_set(InputIterator f, InputIterator l,
00088 size_type n = 10,
00089 const hasher& hf = hasher(),
00090 const key_equal& eql = key_equal(),
00091 const allocator_type& a = allocator_type())
00092 : Base (f, l, n, hf, Internal::mod_range_hashing(),
00093 Internal::default_ranged_hash(),
00094 eql, Internal::identity<Value>(), a)
00095 { }
00096 };
00097
00098 template<class Value,
00099 class Hash = hash<Value>,
00100 class Pred = std::equal_to<Value>,
00101 class Alloc = std::allocator<Value>,
00102 bool cache_hash_code = false>
00103 class unordered_multiset
00104 : public hashtable <Value, Value, Alloc,
00105 Internal::identity<Value>, Pred,
00106 Hash, Internal::mod_range_hashing,
00107 Internal::default_ranged_hash,
00108 Internal::prime_rehash_policy,
00109 cache_hash_code, true, false>
00110 {
00111 typedef hashtable<Value, Value, Alloc,
00112 Internal::identity<Value>, Pred,
00113 Hash, Internal::mod_range_hashing,
00114 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
00126 unordered_multiset(size_type n = 10,
00127 const hasher& hf = hasher(),
00128 const key_equal& eql = key_equal(),
00129 const allocator_type& a = allocator_type())
00130 : Base (n, hf, Internal::mod_range_hashing(),
00131 Internal::default_ranged_hash(),
00132 eql, Internal::identity<Value>(), a)
00133 { }
00134
00135
00136 template<typename InputIterator>
00137 unordered_multiset(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, n, hf, Internal::mod_range_hashing(),
00143 Internal::default_ranged_hash(), eql,
00144 Internal::identity<Value>(), a)
00145 { }
00146 };
00147
00148 template<class Value, class Hash, class Pred, class Alloc,
00149 bool cache_hash_code>
00150 inline void
00151 swap (unordered_set<Value, Hash, Pred, Alloc, cache_hash_code>& x,
00152 unordered_set<Value, Hash, Pred, Alloc, cache_hash_code>& y)
00153 { x.swap(y); }
00154
00155 template<class Value, class Hash, class Pred, class Alloc,
00156 bool cache_hash_code>
00157 inline void
00158 swap(unordered_multiset<Value, Hash, Pred, Alloc, cache_hash_code>& x,
00159 unordered_multiset<Value, Hash, Pred, Alloc, cache_hash_code>& y)
00160 { x.swap(y); }
00161
00162 }
00163 }
00164
00165 #endif