Sources Pipelines Documentation

Allocators  
Public Member Functions | List of all members
boost::memory::stack_allocator< capacity, alignment > Class Template Reference

Allocates memory block from a fixed range reserved from the current execution stack. More...

#include <stack_allocator.hpp>

Public Member Functions

memory_block allocate (std::size_t size)
 Allocated a block of the requested size on the stack. More...
 
void deallocate (memory_block &block)
 Deallocates the block if possible. More...
 
bool owns (memory_block &block) const noexcept
 Determines if the block has been allocated with this allocator. More...
 

Detailed Description

template<std::size_t capacity, std::size_t alignment = NO_ALIGNMENT>
class boost::memory::stack_allocator< capacity, alignment >

Allocates memory block from a fixed range reserved from the current execution stack.

Template Parameters
capacityNumber of bytes to reserve on the stack.
alignmentDefines alignment boundary for allocated blocks.

Definition at line 24 of file stack_allocator.hpp.

Member Function Documentation

template<std::size_t capacity, std::size_t alignment>
memory_block boost::memory::stack_allocator< capacity, alignment >::allocate ( std::size_t  size)
inline

Allocated a block of the requested size on the stack.

Retrieves location and size of block allocated within execution stack range reserved by this allocator. The location is aligned according to value of alignment template parameter.

Parameters
sizeThe size of block to be allocated.
Returns
A valid memory_block definition or null_block if memory block can't be allocated.

Definition at line 16 of file stack_allocator.ipp.

template<std::size_t capacity, std::size_t alignment>
void boost::memory::stack_allocator< capacity, alignment >::deallocate ( memory_block block)
inline

Deallocates the block if possible.

Parameters
blockA memory_block to deallocate.

Definition at line 36 of file stack_allocator.ipp.

template<std::size_t capacity, std::size_t alignment>
bool boost::memory::stack_allocator< capacity, alignment >::owns ( memory_block block) const
inlinenoexcept

Determines if the block has been allocated with this allocator.

Parameters
blockA memory_block to examine.
Returns
true if allocated by this allocator, false otherwise.

Definition at line 49 of file stack_allocator.ipp.


The documentation for this class was generated from the following files: