45 #ifndef CUSTOM_SET_HPP 46 #define CUSTOM_SET_HPP 49 #include "config_HAVE_UNORDERED.hpp" 52 #include <unordered_set> 54 template <
class _Value,
class _Hash = std::hash<_Value>,
class _Pred = std::equal_to<_Value>,
55 class _Alloc = std::allocator<_Value>>
58 template <
typename Key,
typename Compare = std::less<Key>,
typename Alloc = std::allocator<Key>>
61 #if !defined(__clang__) && (__GNUC__ == 4 && __GNUC_MINOR__ <= 8) 62 #ifndef NO_ABSEIL_HASH 63 #define NO_ABSEIL_HASH 1 67 template <
class _Value,
class _Hash = std::hash<_Value>,
class _Pred = std::equal_to<_Value>,
68 class _Alloc = std::allocator<_Value>>
71 template <
class T,
class _Hash = std::hash<T>,
class _Pred = std::equal_to<T>,
class _Alloc = std::allocator<T>>
78 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
80 this->
insert(*other_element);
87 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
89 this->erase(*other_element);
96 return_value -= other;
104 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
106 if(this->find(*other_element) != this->end())
108 return_value.insert(*other_element);
115 template <
typename Key,
typename Compare = std::less<Key>,
typename _Alloc = std::allocator<Key>>
122 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
124 this->
insert(*other_element);
131 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
133 this->erase(*other_element);
140 std::set_difference(this->begin(), this->end(), other.begin(), other.end(),
141 std::inserter(return_value, return_value.begin()));
149 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
151 if(this->find(*other_element) != this->end())
153 return_value.insert(*other_element);
161 template <
typename T>
164 template <
typename T>
169 #ifndef NO_ABSEIL_HASH 170 #define NO_ABSEIL_HASH 0 172 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) 173 #pragma GCC diagnostic push 174 #pragma GCC diagnostic ignored "-Wsign-conversion" 175 #pragma GCC diagnostic ignored "-Wconversion" 176 #pragma GCC diagnostic ignored "-Wpedantic" 177 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy" 178 #pragma GCC diagnostic ignored "-Woverflow" 179 #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" 180 #pragma GCC diagnostic ignored "-Wstrict-overflow" 182 #pragma GCC diagnostic warning "-Wsign-conversion" 183 #pragma GCC diagnostic warning "-Wconversion" 184 #pragma GCC diagnostic warning "-Wpedantic" 185 #pragma GCC diagnostic warning "-Wctor-dtor-privacy" 186 #pragma GCC diagnostic warning "-Woverflow" 187 #pragma GCC diagnostic warning "-Wzero-as-null-pointer-constant" 190 #if defined(__clang__) 191 #pragma clang diagnostic push 192 #pragma clang diagnostic ignored "-Wsign-conversion" 193 #pragma clang diagnostic ignored "-Wconversion" 194 #pragma clang diagnostic ignored "-Wdouble-promotion" 195 #pragma clang diagnostic ignored "-Wshorten-64-to-32" 196 #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" 197 #pragma clang diagnostic ignored "-Wextra-semi" 200 #include "absl/container/btree_set.h" 201 #include "absl/container/flat_hash_set.h" 202 #include "absl/container/node_hash_set.h" 203 #include "absl/hash/hash.h" 206 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) 207 #pragma GCC diagnostic pop 209 #if defined(__clang__) 210 #pragma clang diagnostic pop 213 template <class _Value, class _Hash = typename absl::node_hash_set<_Value>::hasher,
214 class _Pred =
typename absl::node_hash_set<_Value>::key_equal,
class _Alloc = std::allocator<_Value>>
217 template <class T, class _Hash = typename absl::flat_hash_set<T>::hasher,
218 class _Eq =
typename absl::flat_hash_set<T>::key_equal,
class _Alloc = std::allocator<T>>
225 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
227 this->
insert(*other_element);
234 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
236 this->erase(*other_element);
243 return_value -= other;
251 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
253 if(this->find(*other_element) != this->end())
255 return_value.insert(*other_element);
262 template <
typename Key,
typename Compare = std::less<Key>,
typename Alloc = std::allocator<Key>>
269 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
271 this->
insert(*other_element);
278 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
280 this->erase(*other_element);
287 std::set_difference(this->begin(), this->end(), other.begin(), other.end(),
288 std::inserter(return_value, return_value.begin()));
296 for(other_element = other.begin(); other_element != other_element_end; ++other_element)
298 if(this->find(*other_element) != this->end())
300 return_value.insert(*other_element);
308 template <
typename T>
311 template <
typename T>
absl::node_hash_set< _Value, _Hash, _Pred, _Alloc > UnorderedSetStdStable
std::unordered_set< _Value, _Hash, _Pred, _Alloc > UnorderedSetStd
Autoheader include.
CustomUnorderedSet Intersect(const CustomUnorderedSet &other) const
void insert(node_tree **tree, int val)
CustomOrderedSet Intersect(const CustomOrderedSet &other) const
void operator-=(const CustomOrderedSet &other)
void operator+=(const CustomOrderedSet &other)
std::set< Key, Compare, Alloc > OrderedSetStd
void operator+=(const CustomUnorderedSet &other)
CustomOrderedSet operator-(const CustomOrderedSet &other) const
void operator-=(const CustomUnorderedSet &other)
CustomUnorderedSet operator-(const CustomUnorderedSet &other) const