StormByte 2.0.0
C++26 foundation of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Heap::Allocator< T > Struct Template Reference

std::shared_ptr allocator that uses Allocate / Free. More...

#include <StormByte/safe_pointers.hxx>

Public Types

using value_type = T
 Allocator value type.
 

Public Member Functions

constexpr Allocator () noexcept=default
 Default constructor.
 
template<typename U >
constexpr Allocator (const Allocator< U > &) noexcept
 Rebind constructor.
 
T * allocate (std::size_t count)
 Allocate count objects of T.
 
void deallocate (T *pointer, std::size_t) noexcept
 Release storage obtained from allocate.
 
template<typename U >
constexpr bool operator== (const Allocator< U > &) const noexcept
 All Allocator instances compare equal.
 

Detailed Description

template<typename T>
struct StormByte::Heap::Allocator< T >

std::shared_ptr allocator that uses Allocate / Free.

Template Parameters
TControl-block value type.

Member Typedef Documentation

◆ value_type

template<typename T >
using StormByte::Heap::Allocator< T >::value_type = T

Allocator value type.

Constructor & Destructor Documentation

◆ Allocator() [1/2]

template<typename T >
constexpr StormByte::Heap::Allocator< T >::Allocator ( )
constexprdefaultnoexcept

Default constructor.

◆ Allocator() [2/2]

template<typename T >
template<typename U >
constexpr StormByte::Heap::Allocator< T >::Allocator ( const Allocator< U > &  )
inlineconstexprnoexcept

Rebind constructor.

Template Parameters
UOther allocator value type.

Member Function Documentation

◆ allocate()

template<typename T >
T * StormByte::Heap::Allocator< T >::allocate ( std::size_t  count)
inline

Allocate count objects of T.

Parameters
countObject count.
Returns
Storage for count objects.

◆ deallocate()

template<typename T >
void StormByte::Heap::Allocator< T >::deallocate ( T *  pointer,
std::size_t   
)
inlinenoexcept

Release storage obtained from allocate.

Parameters
pointerStorage to release.

◆ operator==()

template<typename T >
template<typename U >
constexpr bool StormByte::Heap::Allocator< T >::operator== ( const Allocator< U > &  ) const
inlineconstexprnoexcept

All Allocator instances compare equal.

Template Parameters
UOther allocator value type.
Returns
Always true.

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