memory
Typedefs | Member Functions
threshold_segregatable< RawAllocator > Class Template Reference

Detailed Description

template<class RawAllocator>
class foonathan::memory::threshold_segregatable< RawAllocator >

A Segregatable that allocates until a maximum size.

Typedefs

using allocator_type = typename allocator_traits< RawAllocator >::allocator_type
 

Member Functions

 threshold_segregatable (std::size_t max_size, allocator_type alloc=allocator_type())
 
bool use_allocate_node (std::size_t size, std::size_t) noexcept
 
bool use_allocate_array (std::size_t count, std::size_t size, std::size_t) noexcept
 
allocator_type & get_allocator () noexcept
 
const allocator_type & get_allocator () const noexcept
 

Constructors

◆ threshold_segregatable()

threshold_segregatable ( std::size_t  max_size,
allocator_type  alloc = allocator_type() 
)
explicit
Effects:
Creates it by passing the maximum size it will allocate and the allocator it uses.

Member Functions

◆ use_allocate_node()

bool use_allocate_node ( std::size_t  size,
std::size_t   
)
noexcept
Returns:
true if size is less then or equal to the maximum size, false otherwise.
Note
A return value of true means that the allocator will be used for the allocation.

◆ use_allocate_array()

bool use_allocate_array ( std::size_t  count,
std::size_t  size,
std::size_t   
)
noexcept
Returns:
true if count * size is less then or equal to the maximum size, false otherwise.
Note
A return value of true means that the allocator will be used for the allocation.

◆ get_allocator() [1/2]

allocator_type & get_allocator ( )
noexcept
Returns:
A reference to the allocator it owns.

◆ get_allocator() [2/2]

const allocator_type & get_allocator ( ) const
noexcept
Returns:
A reference to the allocator it owns.