15 static_assert(std::is_unsigned<T>::value,
16 "sparse-set: requires unsigned indexes");
30 template <
template <
typename Elt>
class Container,
31 typename = decltype(std::declval<Container<T>>().
size())>
37 for (
const auto& elt : cont)
87 sparse_[last] = sparse_[e];
127 template <
typename T>
void erase(T e)
Erase an element.
sparse_set(size_t max_size=0)
The template parameter corresponds to indexes so it has to be unsigned.
Sparse Set implementation.
std::vector< T > sparse_
Indexes of elements in the dense_ vector.
bool insert(T e)
Insert new value.
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
std::vector< T > dense_
Actual elements of the set, not sorted.
void clear()
Flush all elements from the set.
T curr_
Current number of elements.
void set_max_size(size_t max_size)
Set current vector size.
ATTRIBUTE_PURE bool has(const boost::container::flat_set< Key, Compare, Allocator > &s, const Key &e)
Whether e is member of s.
sparse_set(const Container< T > &cont)
Construct with a container.