![]() |
WPILibC++ 2025.3.2
|
A stateful RawAllocator that is designed for allocations in a loop. More...
#include <wpi/memory/iteration_allocator.hpp>
Public Types | |
| using | allocator_type = detail::iteration_block_allocator<BlockOrRawAllocator> |
Public Member Functions | |
| template<typename... Args> | |
| iteration_allocator (std::size_t block_size, Args &&... args) | |
| iteration_allocator (iteration_allocator &&other) noexcept | |
| ~iteration_allocator () noexcept | |
| iteration_allocator & | operator= (iteration_allocator &&other) noexcept |
| void * | allocate (std::size_t size, std::size_t alignment) |
| void * | try_allocate (std::size_t size, std::size_t alignment) noexcept |
| void | next_iteration () noexcept |
| std::size_t | cur_iteration () const noexcept |
| allocator_type & | get_allocator () noexcept |
| std::size_t | capacity_left (std::size_t i) const noexcept |
| std::size_t | capacity_left () const noexcept |
Static Public Member Functions | |
| static std::size_t | max_iterations () noexcept |
A stateful RawAllocator that is designed for allocations in a loop.
It uses N stacks for the allocation, one of them is always active. Allocation uses the currently active stack. Calling iteration_allocator::next_iteration() at the end of the loop, will make the next stack active for allocation, effectively releasing all of its memory. Any memory allocated will thus be usable for N iterations of the loop. This type of allocator is a generalization of the double frame allocator.
| using wpi::memory::iteration_allocator< N, BlockOrRawAllocator >::allocator_type = detail::iteration_block_allocator<BlockOrRawAllocator> |
|
inlineexplicit |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
size and alignment must be valid.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinestaticnoexcept |
N.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
nullptr if the current stack does not have any memory left.