40template<
class T,
template<
class ...>
class Storage=std::vector,
class hash=std::hash<T> >
46 using iterator=
decltype(std::begin(std::declval<storage_t&>()));
103 template<
class K,
class=std::enable_if_t<std::is_convertible<K, T>{}> >
105 return std::find(
begin(),
end(), k );
112 template<
class K,
class=std::enable_if_t<std::is_convertible<K, T>{}> >
128 template<
class K,
class=std::enable_if_t<std::is_convertible<K,T>{}> >
131 auto it =
find(value);
139 template<
class K,
class=std::enable_if_t<std::is_convertible<K,T>{}> >
142 auto it =
find(value);
144 storage.emplace_back( std::forward<T>(value) );
174 T min{};
bool found=
false;
175 for(
const auto &i: *
this) {
188 T min2{}; found=
false;
189 for(
const auto &i: rhs) {
208template<
class T,
template<
class ...>
class Storage,
class h>
217 size_t result = 0xDEADBEEF;
218 for(
const auto &i: key)
Flat set with pluggable storage.
decltype(std::begin(std::declval< const storage_t & >())) const_iterator
Const iterator.
iterator erase(const_iterator it)
Remove the element at it.
bool empty() const
Return true if the set is empty.
hash hash_t
Hash functor type for elements.
bool operator==(const flat_set &rhs) const
Compare two flat_sets for equality (order-independent).
iterator begin()
Return iterator to the first element.
const_iterator cend() const
Return const iterator past the last element.
iterator end()
Return iterator past the last element.
bool operator<(const flat_set &rhs) const
Less-than comparison based on minimum differing element.
Storage< T > storage_t
Underlying container type.
void insert(K &&value)
Insert value if not already present (rvalue overload).
void reserve(size_t n)
Reserve storage for at least n elements.
size_t capacity() const
Return the current storage capacity.
const_iterator find(K &&k) const
Find an element equal to k (const overload).
decltype(std::begin(std::declval< storage_t & >())) iterator
Mutable iterator.
size_t size() const
Return the number of elements in the set.
storage_t storage
Contiguous element storage.
void insert(const K &value)
Insert value if not already present (const-ref overload).
iterator find(K &&k)
Find an element equal to k.
const_iterator end() const
Return const iterator past the last element.
const_iterator begin() const
Return const iterator to the first element.
const_iterator cbegin() const
Return const iterator to the first element.
size_t operator()(const flat_set< T, Storage > &key) const
Compute the hash of a flat_set by XOR-folding element hashes.