|
libhatchet
|
#include <hxhandle_map.hpp>
Public Types | |
| using | iterator = T* |
| using | const_iterator = const T* |
| using | value_t = T |
Public Member Functions | |
| hxhandle_map (void) | |
| ~hxhandle_map () | |
| const T * | begin (void) const |
| T * | begin (void) |
| hxsize_t | capacity (void) const |
| const T * | cbegin (void) const |
| const T * | cend (void) const |
| void | clear (void) noexcept |
| const T * | data (void) const |
| T * | data (void) |
| const T * | end (void) const |
| T * | end (void) |
| bool | empty (void) const |
| bool | erase (hxhandle_t handle_) noexcept |
| template<typename callable_t_> | |
| hxsize_t | erase_if (callable_t_ &&callable_) noexcept |
| bool | full (void) const |
| T * | get (hxhandle_t handle_) noexcept |
| const T * | get (hxhandle_t handle_) const noexcept |
| hxhandle_t | handle_at (hxsize_t index_) const noexcept |
| template<typename... args_t_> | |
| hxhandle_t | insert (args_t_ &&... args_) noexcept |
| hxsize_t | max_size (void) const |
| void | set_size_bits (uint32_t bits_) |
| hxsize_t | size (void) const |
hxhandle_map - A table that maps 64-bit generational handles to values kept in a contiguous array of size 2^table_size_bits - 1 without reallocating memory.
data() always references size() contiguous values. Pointers into data are invalidated by erase and insert while handles are not. Handle 0 is never valid. If non-zero, the template parameter table_size_bits configures the capacity to 2^table_size_bits - 1 values. Otherwise use set_size_bits to configure the size dynamically.
| using hxhandle_map< T, table_size_bits_ >::const_iterator = const T* |
const_iterator - Const random access iterator.
| using hxhandle_map< T, table_size_bits_ >::iterator = T* |
iterator - Random access iterator.
| using hxhandle_map< T, table_size_bits_ >::value_t = T |
| hxhandle_map< T, table_size_bits_ >::hxhandle_map | ( | void | ) |
Constructs an empty map with a capacity of 2^table_size_bits - 1.
| hxhandle_map< T, table_size_bits_ >::~hxhandle_map | ( | ) |
Destructs the map and destroys all values.
|
inline |
Returns a T* to the beginning of the values (alias for data).
Iterators are invalidated by modification of the table.
|
inline |
Returns a const T* to the beginning of the values (alias for data).
Iterators are invalidated by modification of the table.
|
inline |
Returns the number of values that can be stored.
|
inline |
Returns a const T* to the beginning of the values (alias for begin).
Iterators are invalidated by modification of the table.
|
inline |
Returns a const T* to the end of the values.
Iterators are invalidated by modification of the table.
|
noexcept |
Destroys all values and invalidates their handles.
|
inline |
Returns a pointer to the first of size contiguous values.
|
inline |
Returns a const pointer to the first of size contiguous values.
|
inline |
Checks if the map is empty.
|
inline |
Returns a T* to the end of the values.
Iterators are invalidated by modification of the table.
|
inline |
Returns a const T* to the end of the values.
Iterators are invalidated by modification of the table.
|
noexcept |
Returns true if handle resolved and its value was destroyed.
The last value is move-assigned into the hole to keep the values contiguous.
|
noexcept |
Returns the number of values destroyed.
Calls callable with a T& for every value and destroys those for which it returns true.
|
inline |
Checks if the map is full.
|
noexcept |
const version of get.
|
noexcept |
Returns a pointer to the value referenced by handle if it resolves, otherwise hxnull.
|
noexcept |
|
noexcept |
Returns a non-zero handle referencing a value constructed at the end of data from args.
The map must not be full.
|
inline |
Returns the maximum number of values that can be stored.
| void hxhandle_map< T, table_size_bits_ >::set_size_bits | ( | uint32_t | bits_ | ) |
Sets the number of index bits and allocates memory for the map (only for dynamic capacity).
|
inline |
Returns the number of values in the map.