3 #include <boost/optional.hpp>
14 template <
typename Key,
typename Value>
18 static_assert(std::is_unsigned<Key>::value,
19 "sparse-set: requires unsigned indexes");
34 template <
typename K,
typename V>
37 return insert(std::make_pair(k,
v));
44 bool insert(
const std::pair<Key, Value>& p)
121 std::vector<std::pair<Key, Value>>
dense_;
126 template <
typename Key,
typename Value>
#define V(S)
Display S and its value.
bool emplace(K &&k, V &&v)
std::vector< std::pair< Key, Value > > dense_
ATTRIBUTE_PURE bool has(const boost::container::flat_set< Key, Compare, Allocator > &s, const Key &e)
Whether e is member of s.
bool insert(const std::pair< Key, Value > &p)
Insert new value.
void clear()
Flush all elements from the set.
Sparse Map implementation.
sparse_map(size_t max_size=0)
The Keys correspond to indexes so they have to be unsigned.
void set_max_size(size_t max_size)
Value & operator[](Key k)
Access an element.
void erase(Key k)
Erase an element.
std::vector< Key > sparse_