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