Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::allocator< T > Class Template Reference

Implementation of std::allocator<> More...

Classes

struct  rebind
 Its member type other is the equivalent allocator type to allocate elements of type T More...
 

Public Types

typedef T value_type
 Type of object this allocator is creating memory.
 
typedef uintptr_t size_type
 Quantities of elements.
 
typedef intptr_t difference_type
 Difference between pointers.
 
typedef T * pointer
 Pointer to element.
 
typedef const T * const_pointer
 Pointer to constant element.
 
typedef T & reference
 Reference to element.
 
typedef const T & const_reference
 Reference to constant element.
 
typedef true_type propagate_on_container_move_assignment
 Propagate on move assignment.
 
typedef true_type propagate_on_container_copy_assignment
 Copy the allocator when copy assigned.
 
typedef true_type propagate_on_container_swap
 Swap allocators on swap assignment.
 
typedef true_type is_always_equal
 This allocator matches any other allocator type.
 

Public Member Functions

constexpr allocator () noexcept=default
 Default constructor.
 
 ~allocator ()=default
 Default destructor.
 
constexpr allocator (const allocator &) noexcept=default
 Copy constructor.
 
constexpr allocator (allocator &&) noexcept=default
 Move constructor.
 
allocatoroperator= (allocator &&) noexcept=default
 Assignment move constructor.
 
template<class U >
 allocator (const allocator< U > &)
 Allocator that crosses types.
 
pointer address (reference x) noexcept
 Returns the address of x.
 
const_pointer address (const_reference x) const noexcept
 Returns the const address of x.
 
T * allocate (uintptr_t n) noexcept
 Allocate memory for n chunks of data.
 
void deallocate (pointer p, size_type) noexcept
 Free memory allocated.
 
uintptr_t max_size () const noexcept
 Maximum size possible to allocate.
 
void construct (pointer p)
 Default constructs an object.
 
void destroy (pointer p)
 Destroys the contents of an object.
 

Detailed Description

template<class T>
class Burger::allocator< T >

Implementation of std::allocator<>


Implements a standard allocator using a combination of functions from C++98 through C++20. Allocates memory through operator new() and operator delete()

Member Typedef Documentation

◆ const_pointer

template<class T >
const T* Burger::allocator< T >::const_pointer

Pointer to constant element.

◆ const_reference

template<class T >
const T& Burger::allocator< T >::const_reference

Reference to constant element.

◆ difference_type

template<class T >
intptr_t Burger::allocator< T >::difference_type

Difference between pointers.

◆ is_always_equal

template<class T >
true_type Burger::allocator< T >::is_always_equal

This allocator matches any other allocator type.

◆ pointer

template<class T >
T* Burger::allocator< T >::pointer

Pointer to element.

◆ propagate_on_container_copy_assignment

template<class T >
true_type Burger::allocator< T >::propagate_on_container_copy_assignment

Copy the allocator when copy assigned.

◆ propagate_on_container_move_assignment

template<class T >
true_type Burger::allocator< T >::propagate_on_container_move_assignment

Propagate on move assignment.

◆ propagate_on_container_swap

template<class T >
true_type Burger::allocator< T >::propagate_on_container_swap

Swap allocators on swap assignment.

◆ reference

template<class T >
T& Burger::allocator< T >::reference

Reference to element.

◆ size_type

template<class T >
uintptr_t Burger::allocator< T >::size_type

Quantities of elements.

◆ value_type

template<class T >
T Burger::allocator< T >::value_type

Type of object this allocator is creating memory.

Constructor & Destructor Documentation

◆ allocator() [1/4]

template<class T >
Burger::allocator< T >::allocator ( )
constexprdefaultnoexcept

Default constructor.

◆ ~allocator()

template<class T >
Burger::allocator< T >::~allocator ( )
default

Default destructor.

◆ allocator() [2/4]

template<class T >
Burger::allocator< T >::allocator ( const allocator< T > & )
constexprdefaultnoexcept

Copy constructor.

◆ allocator() [3/4]

template<class T >
Burger::allocator< T >::allocator ( allocator< T > && )
constexprdefaultnoexcept

Move constructor.

◆ allocator() [4/4]

template<class T >
template<class U >
Burger::allocator< T >::allocator ( const allocator< U > & )
inline

Allocator that crosses types.

Since this allocator can share pools, this exists and does nothing.

Member Function Documentation

◆ address() [1/2]

template<class T >
const_pointer Burger::allocator< T >::address ( const_reference x) const
inlinenoexcept

Returns the const address of x.

◆ address() [2/2]

template<class T >
pointer Burger::allocator< T >::address ( reference x)
inlinenoexcept

Returns the address of x.

◆ allocate()

template<class T >
T * Burger::allocator< T >::allocate ( uintptr_t n)
inlinenoexcept

Allocate memory for n chunks of data.


Parameters
nNumber of elements to allocate
Returns
Pointer to allocated memory or nullptr on failure.

◆ construct()

template<class T >
void Burger::allocator< T >::construct ( pointer p)
inline

Default constructs an object.

◆ deallocate()

template<class T >
void Burger::allocator< T >::deallocate ( pointer p,
size_type  )
inlinenoexcept

Free memory allocated.


Note
The second parameter is ignored in this allocator
Parameters
pPointer to memory to release

◆ destroy()

template<class T >
void Burger::allocator< T >::destroy ( pointer p)
inline

Destroys the contents of an object.

◆ max_size()

template<class T >
uintptr_t Burger::allocator< T >::max_size ( ) const
inlinenoexcept

Maximum size possible to allocate.


Returns the maximum number of elements, each of member type value_type (an alias of allocator's template parameter) that could potentially be allocated by a call to member allocate.

Returns
UINTMAX_MAX

◆ operator=()

template<class T >
allocator & Burger::allocator< T >::operator= ( allocator< T > && )
defaultnoexcept

Assignment move constructor.