|
| | hxhandle_table (deleter_t_ deleter_=deleter_t_()) |
| | ~hxhandle_table (void) |
| template<typename self_t_, typename callable_t_> |
| auto | and_then (this self_t_ &&self_, hxhandle_t handle_, callable_t_ &&callable_) -> hxremove_cvref_t< decltype(hxforward< callable_t_ >(callable_)(hxforward_like< self_t_ >(hxdeclval< T & >())))> |
| hxsize_t | capacity (void) const |
| template<typename deleter_u_> |
| void | clear (deleter_u_ &&deleter_) noexcept |
| void | clear (void) noexcept |
| const deleter_t_ & | deleter (void) const |
| deleter_t_ & | deleter (void) |
| bool | empty (void) const |
| 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 |
| 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 |
| template<typename self_t_, typename callable_t_> |
| auto | or_else (this self_t_ &&self_, hxhandle_t handle_, callable_t_ &&callable_) -> decltype(self_.value(handle_)) |
| void | release_all (void) noexcept |
| template<typename deleter_u_> |
| bool | reset (hxhandle_t handle_, deleter_u_ &&deleter_) noexcept |
| bool | reset (hxhandle_t handle_) noexcept |
| void | set_size_bits (uint32_t bits_) |
| hxsize_t | size (void) const |
| const T * | value (hxhandle_t handle_) const noexcept |
| T * | value (hxhandle_t handle_) noexcept |
| template<typename self_t_, typename... args_t_> |
| T | value_or (this self_t_ &&self_, hxhandle_t handle_, args_t_ &&... args_) |
template<hxhandle_table_concept_ T, typename deleter_t_ = hxdefault_delete, uint32_t table_size_bits_ = hxallocator_dynamic_capacity>
class hxhandle_table< T, deleter_t_, table_size_bits_ >
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.
- T : The pointed-to type stored in the table.
- deleter_t : A class type invoked as deleter(T*) to free the owned pointer. See also hxdo_not_delete.
- table_size_bits : If non-zero, fixes the table to 2^table_size_bits-1 slots. Otherwise the size is dynamic.
template<hxhandle_table_concept_ T, typename deleter_t_ = hxdefault_delete, uint32_t table_size_bits_ = hxallocator_dynamic_capacity>
template<typename self_t_, typename callable_t_>
Returns the result of calling callable with the value referenced by handle, otherwise returns hxnil.
Use and_then to return hxptr, hxref or hxexpected.
- handle : The handle identifying the value to look up.
- callable : The function to call with the value.
template<hxhandle_table_concept_ T, typename deleter_t_ = hxdefault_delete, uint32_t table_size_bits_ = hxallocator_dynamic_capacity>
template<typename callable_t_>
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.
- callable : Returns true for values to erase.
template<hxhandle_table_concept_ T, typename deleter_t_ = hxdefault_delete, uint32_t table_size_bits_ = hxallocator_dynamic_capacity>
template<typename deleter_u_>
Takes ownership of the value owned by ptr and returns a non-zero handle referencing it, or hxnull_handle if ptr is empty.
The table must not be full.
- ptr : The hxptr owning the value to insert.
template<hxhandle_table_concept_ T, typename deleter_t_ = hxdefault_delete, uint32_t table_size_bits_ = hxallocator_dynamic_capacity>
template<typename self_t_, typename callable_t_>
| auto hxhandle_table< T, deleter_t_, table_size_bits_ >::or_else |
( |
this self_t_ && | self_, |
|
|
hxhandle_t | handle_, |
|
|
callable_t_ && | callable_ )->decltype(self_.value(handle_)) |
Returns a pointer to the value referenced by handle, or the result of calling callable when the handle does not resolve.
- handle : The handle identifying the value to look up.
- callable : The function to call when lookup fails. Must return a T pointer.
template<hxhandle_table_concept_ T, typename deleter_t_ = hxdefault_delete, uint32_t table_size_bits_ = hxallocator_dynamic_capacity>
template<typename self_t_, typename... args_t_>
| T hxhandle_table< T, deleter_t_, table_size_bits_ >::value_or |
( |
this self_t_ && | self_, |
|
|
hxhandle_t | handle_, |
|
|
args_t_ &&... | args_ ) |
Returns a copy of the value referenced by handle, or a value constructed from args when the handle does not resolve.
- handle : The handle identifying the value to look up.
- args : The arguments used to construct the value when lookup fails.