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>
T curr_
Current number of elements.
sparse_set(const Container< T > &cont)
Construct with a container.
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
void clear()
Flush all elements from the set.
ATTRIBUTE_PURE bool has(const boost::container::flat_set< Key, Compare, Allocator > &s, const Key &e)
Whether e is member of s.
Sparse Set implementation.
bool insert(T e)
Insert new value.
void erase(T e)
Erase an element.
std::vector< T > dense_
Actual elements of the set, not sorted.
sparse_set(size_t max_size=0)
The template parameter corresponds to indexes so it has to be unsigned.
void set_max_size(size_t max_size)
Set current vector size.
std::vector< T > sparse_
Indexes of elements in the dense_ vector.