Sources Pipelines Documentation

Allocators  
Public Member Functions | List of all members
boost::memory::segregator< threshold, primary_allocator, secondary_allocator > Class Template Reference

Segregates allocation strategies according to the given allocation size threshold. More...

#include <segregator.hpp>

Public Member Functions

memory_block allocate (std::size_t size)
 Allocates a memory block of the given size. More...
 
void deallocate (memory_block &block)
 Deallocates the given memory_block if possible. More...
 
bool owns (memory_block &block)
 Checks if the given memory block has been allocated by this allocator. More...
 
primary_allocator & get_primary () noexcept
 Gets a reference to the primary allocator. More...
 
secondary_allocator & get_secondary () noexcept
 Gets a reference to the secondary allocator. More...
 

Detailed Description

template<std::size_t threshold, typename primary_allocator, typename secondary_allocator>
class boost::memory::segregator< threshold, primary_allocator, secondary_allocator >

Segregates allocation strategies according to the given allocation size threshold.

Segregates the given allocators in a way it uses the first one for allocation of all blocks which size is less or equal to the given threshold and the second allocator for blocks larger than the threshold.

Template Parameters
thresholdSize threshold used as segregation criteria.
primary_allocatorAllocator used for allocation of blocks smaller or equal to threshold.
secondary_allocatorAllocator used for allocation of blocks larger than threshold.

Definition at line 31 of file segregator.hpp.

Member Function Documentation

template<std::size_t threshold, typename primary_allocator , typename secondary_allocator >
memory_block boost::memory::segregator< threshold, primary_allocator, secondary_allocator >::allocate ( std::size_t  size)
inline

Allocates a memory block of the given size.

Parameters
sizeSize of a block to be allocated.
Returns
An allocated memory block.

Definition at line 17 of file segregator.ipp.

template<std::size_t threshold, typename primary_allocator , typename secondary_allocator >
void boost::memory::segregator< threshold, primary_allocator, secondary_allocator >::deallocate ( memory_block block)
inline

Deallocates the given memory_block if possible.

Parameters
blockThe block to deallocate.

Definition at line 32 of file segregator.ipp.

Referenced by boost::memory::segregator< threshold, primary_allocator, secondary_allocator >::deallocate().

template<std::size_t threshold, typename primary_allocator , typename secondary_allocator >
primary_allocator & boost::memory::segregator< threshold, primary_allocator, secondary_allocator >::get_primary ( )
inlinenoexcept

Gets a reference to the primary allocator.

Returns
A reference to the primary allocator.

Definition at line 59 of file segregator.ipp.

template<std::size_t threshold, typename primary_allocator , typename secondary_allocator >
secondary_allocator & boost::memory::segregator< threshold, primary_allocator, secondary_allocator >::get_secondary ( )
inlinenoexcept

Gets a reference to the secondary allocator.

Returns
A reference to the secondary allocator.

Definition at line 71 of file segregator.ipp.

template<std::size_t threshold, typename primary_allocator , typename secondary_allocator >
bool boost::memory::segregator< threshold, primary_allocator, secondary_allocator >::owns ( memory_block block)
inline

Checks if the given memory block has been allocated by this allocator.

Parameters
blockA block to check.
Returns
true if the block has been allocated by this allocator, false otherwise.

Definition at line 47 of file segregator.ipp.


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