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

This stateless allocator performs all of its allocation calls using aligned memory invocations. More...

#include <aligned_allocator.hpp>

Public Types

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

Public Member Functions

 aligned_allocator ()=default
 Default-constructs a aligned_allocator.
 
 aligned_allocator (aligned_allocator &&other) noexcept=default
 Move-constructs an aligned_allocator from another allocator. More...
 
 aligned_allocator (const aligned_allocator &other) noexcept=default
 Copy-constructs an aligned_allocator from another allocator. More...
 
aligned_allocatoroperator= (aligned_allocator &&other) noexcept=default
 Move-assigns an aligned_allocator from another allocator. More...
 
aligned_allocatoroperator= (const aligned_allocator &other) noexcept=default
 Copy-assigns an aligned_allocator from another allocator. More...
 
owner< void * > try_allocate (std::size_t size, std::size_t align) noexcept
 Allocates aligned memory of size size, with alignment to a boundary of at least align. More...
 
void deallocate (owner< void *> p, std::size_t size)
 Deallocates a pointer p with the allocation size of size. More...
 
allocator_info info () const noexcept
 Gets the info about this allocator. More...
 

Detailed Description

This stateless allocator performs all of its allocation calls using aligned memory invocations.

Satisfies
Allocator
Satisfies
Stateless

Definition at line 58 of file aligned_allocator.hpp.

Constructor & Destructor Documentation

◆ aligned_allocator() [1/2]

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

Move-constructs an aligned_allocator from another allocator.

Parameters
otherthe other aligned_allocator to move

◆ aligned_allocator() [2/2]

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

Copy-constructs an aligned_allocator from another allocator.

Parameters
otherthe other aligned_allocator to copy

Member Function Documentation

◆ deallocate()

void bit::memory::aligned_allocator::deallocate ( owner< void *>  p,
std::size_t  size 
)

Deallocates a pointer p with the allocation size of size.

Parameters
pthe pointer to deallocate
sizethe size to deallocate

◆ info()

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

Gets the info about this allocator.

This defaults to 'aligned_allocator'. Use a named_aligned_allocator to override this

Returns
the info for this allocator

◆ operator=() [1/2]

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

Move-assigns an aligned_allocator from another allocator.

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

◆ operator=() [2/2]

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

Copy-assigns an aligned_allocator from another allocator.

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

◆ try_allocate()

owner<void*> bit::memory::aligned_allocator::try_allocate ( std::size_t  size,
std::size_t  align 
)
noexcept

Allocates aligned memory of size size, with alignment to a boundary of at least align.

Parameters
sizethe size of this allocation
alignthe requested alignment
Returns
the allocated pointer, or nullptr on failure

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