Template Class PositionIndex
Defined in File PositionIndex.h
Nested Relationships
Nested Types
Class Documentation
-
template<class T, class H = FastHash<const T*>>
class PositionIndex the positions of objects of type T, by their addresses
Public Types
-
using Position = std::uint32_t
the type of the positions
Public Functions
-
bool insert(const T *p, Position i)
gives p the position i; true if p was absent, false if its position was replaced
- Pre:
p is not nil and i < NONE
-
template<std::ranges::random_access_range R>
void assign(const R &v) the index of the vector v of pointers (any range with v[ i ]): v[ i ] at the position i, all the other keys gone
- Pre:
no v[ i ] is nil, and v has fewer than NONE items
-
void renumber(std::span<const Position> E)
the erasure of the positions E from the vector: the keys at a position in E go away, and each other position p becomes p minus the number of the positions of E below p
- Pre:
E is strictly increasing
-
inline std::size_t size(void) const
the number of keys
-
inline bool empty(void) const
-
inline std::size_t capacity(void) const
the number of places of the table
-
inline void reserve(std::size_t n)
room for n keys with no rebuild
-
inline void clear(void)
removes all the keys, keeping the places
-
template<class F>
inline void forEach(F &&f) const f( p , i ) for each key p at the position i, in the order of the places
-
inline void swap(PositionIndex &o) noexcept
-
using Position = std::uint32_t