bit::memory
Public Types | Public Member Functions | List of all members
bit::memory::null_block_allocator Class Reference

A block allocator that only distributes null blocks. More...

#include <null_block_allocator.hpp>

Public Types

using default_block_alignment = std::integral_constant< std::size_t, 1 >
 

Public Member Functions

 null_block_allocator ()=default
 Default-constructs a null_block_allocator.
 
 null_block_allocator (null_block_allocator &&other) noexcept=default
 Move-constructs a null_block_allocator from another allocator. More...
 
 null_block_allocator (const null_block_allocator &other) noexcept=default
 Copy-constructs a null_block_allocator from another allocator. More...
 
null_block_allocatoroperator= (null_block_allocator &&other) noexcept=default
 Move-assigns a null_block_allocator from another allocator. More...
 
null_block_allocatoroperator= (const null_block_allocator &other) noexcept=default
 Copy-assigns a null_block_allocator from another allocator. More...
 
owner< memory_blockallocate_block () noexcept
 Allocates a null memory_block. More...
 
void deallocate_block (owner< memory_block > block) noexcept
 Deallocates a memory_block. More...
 
std::size_t next_block_size () const noexcept
 Queries the next block size expected from this allocator. More...
 
allocator_info info () const noexcept
 Gets the info about this allocator. More...
 

Detailed Description

A block allocator that only distributes null blocks.

Satisfies
BlockAllocator
Satisfies
Stateless

Definition at line 55 of file null_block_allocator.hpp.

Constructor & Destructor Documentation

◆ null_block_allocator() [1/2]

bit::memory::null_block_allocator::null_block_allocator ( null_block_allocator &&  other)
defaultnoexcept

Move-constructs a null_block_allocator from another allocator.

Parameters
otherthe other null_block_allocator to move

◆ null_block_allocator() [2/2]

bit::memory::null_block_allocator::null_block_allocator ( const null_block_allocator other)
defaultnoexcept

Copy-constructs a null_block_allocator from another allocator.

Parameters
otherthe other null_block_allocator to copy

Member Function Documentation

◆ allocate_block()

owner<memory_block> bit::memory::null_block_allocator::allocate_block ( )
noexcept

Allocates a null memory_block.

Returns
a null memory_block

◆ deallocate_block()

void bit::memory::null_block_allocator::deallocate_block ( owner< memory_block block)
noexcept

Deallocates a memory_block.

Parameters
blockthe block to deallocate

◆ info()

allocator_info bit::memory::null_block_allocator::info ( ) const
noexcept

Gets the info about this allocator.

This defaults to 'null_block_allocator'. Use a named_null_block_allocator to override this

Returns
the info for this allocator

◆ next_block_size()

std::size_t bit::memory::null_block_allocator::next_block_size ( ) const
noexcept

Queries the next block size expected from this allocator.

Returns
the size of the next allocated block

◆ operator=() [1/2]

null_block_allocator& bit::memory::null_block_allocator::operator= ( null_block_allocator &&  other)
defaultnoexcept

Move-assigns a null_block_allocator from another allocator.

Parameters
otherthe other null_block_allocator to move
Returns
reference to (*this)

◆ operator=() [2/2]

null_block_allocator& bit::memory::null_block_allocator::operator= ( const null_block_allocator other)
defaultnoexcept

Copy-assigns a null_block_allocator from another allocator.

Parameters
otherthe other null_block_allocator to copy
Returns
reference to (*this)

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