|
libhatchet
|
#include <hxhandle_table.hpp>
Public Types | |
| using | value_t = T |
Public Member Functions | |
| hxhandle_table (deleter_t_ deleter_=deleter_t_()) | |
| ~hxhandle_table (void) | |
| hxsize_t | capacity (void) const |
| template<typename deleter_u_> | |
| void | clear (deleter_u_ &&deleter_) noexcept |
| void | clear (void) noexcept |
| bool | empty (void) const |
| template<typename deleter_u_> | |
| bool | erase (hxhandle_t handle_, deleter_u_ &&deleter_) noexcept |
| bool | erase (hxhandle_t handle_) noexcept |
| template<typename callable_t_> | |
| hxsize_t | erase_if (callable_t_ &&callable_) noexcept |
| hxptr< T, deleter_t_ > | extract (hxhandle_t handle_) noexcept |
| bool | full (void) const |
| T * | get (hxhandle_t handle_) noexcept |
| const T * | get (hxhandle_t handle_) const noexcept |
| const deleter_t_ & | deleter (void) const |
| deleter_t_ & | deleter (void) |
| hxhandle_t | insert (T *ptr_) noexcept |
| template<typename deleter_u_> | |
| hxhandle_t | insert (hxptr< T, deleter_u_ > &&ptr_) noexcept |
| hxsize_t | max_size (void) const |
| void | release_all (void) noexcept |
| void | set_size_bits (uint32_t bits_) |
| hxsize_t | size (void) const |
hxhandle_table - A table that maps 64-bit handles to owned pointers without reallocating memory or moving values.
The table is a fixed 2^table_size_bits - 1 array of handles. Use set_size_bits to configure the size dynamically.
| using hxhandle_table< T, deleter_t_, table_size_bits_ >::value_t = T |
|
explicit |
Constructs an empty table with a capacity of 2^table_size_bits slots and an optional deleter instance.
| hxhandle_table< T, deleter_t_, table_size_bits_ >::~hxhandle_table | ( | void | ) |
Destructs the table and deletes all owned values.
|
inline |
Returns the number of slots in the table.
|
noexcept |
|
inlinenoexcept |
Removes all values and calls the stored deleter on every value.
| deleter_t_ & hxhandle_table< T, deleter_t_, table_size_bits_ >::deleter | ( | void | ) |
Returns a reference to the stored deleter.
| const deleter_t_ & hxhandle_table< T, deleter_t_, table_size_bits_ >::deleter | ( | void | ) | const |
Returns a const reference to the stored deleter.
|
inline |
Checks if the table is empty.
|
inlinenoexcept |
Removes and calls the stored deleter on the value referenced by handle.
|
noexcept |
|
noexcept |
Returns the number of values destroyed.
Calls callable with a T& for every value and calls the stored deleter on those for which it returns true.
|
noexcept |
|
inline |
Checks if the table is full.
|
noexcept |
const version of get.
|
noexcept |
Returns the value referenced by handle if it resolves, otherwise hxnull.
|
noexcept |
Takes ownership of the value owned by ptr and returns a non-zero handle referencing it.
The table must not be full and ptr must not be null.
|
noexcept |
Takes ownership of ptr and returns a non-zero handle referencing it.
The table must not be full and ptr must not be null.
|
inline |
Returns the maximum number of values that can be stored.
|
inlinenoexcept |
Clears the table without deleting any values.
| void hxhandle_table< T, deleter_t_, table_size_bits_ >::set_size_bits | ( | uint32_t | bits_ | ) |
Sets the number of index bits and allocates memory for the table (only for dynamic capacity).
|
inline |
Returns the number of values in the table.