nngn
Loading...
Searching...
No Matches
nngn::reallocator< T > Struct Template Reference

Simple allocator which supports reallocation. More...

#include <realloc.h>

Inheritance diagram for nngn::reallocator< T >:
Collaboration diagram for nngn::reallocator< T >:

Public Types

using value_type = T
 
using pointer = std::add_pointer_t< value_type >
 
using value_type = T
 
using pointer = std::add_pointer_t< value_type >
 

Public Member Functions

pointer allocate (std::size_t n) noexcept
 
pointer reallocate (pointer p, std::size_t n) noexcept
 
void deallocate (pointer p, std::size_t) noexcept
 
pointer allocate (std::size_t n) noexcept
 
pointer reallocate (pointer p, std::size_t n) noexcept
 
void deallocate (pointer p, std::size_t) noexcept
 

Detailed Description

template<trivial T = char>
struct nngn::reallocator< T >

Simple allocator which supports reallocation.

Implemented in terms of malloc(3), realloc(3), and free(3) (which is why T must be nngn::trivial). Can be nested in other allocators that provide an optional reallocate method.

Member Typedef Documentation

◆ pointer [1/2]

template<trivial T = char>
using nngn::reallocator< T >::pointer = std::add_pointer_t<value_type>

◆ pointer [2/2]

template<trivial T = char>
using nngn::reallocator< T >::pointer = std::add_pointer_t<value_type>

◆ value_type [1/2]

template<trivial T = char>
using nngn::reallocator< T >::value_type = T

◆ value_type [2/2]

template<trivial T = char>
using nngn::reallocator< T >::value_type = T

Member Function Documentation

◆ allocate() [1/2]

template<trivial T>
auto nngn::reallocator< T >::allocate ( std::size_t  n)
noexcept

◆ allocate() [2/2]

template<trivial T = char>
pointer nngn::reallocator< T >::allocate ( std::size_t  n)
noexcept

◆ deallocate() [1/2]

template<trivial T = char>
void nngn::reallocator< T >::deallocate ( pointer  p,
std::size_t   
)
inlinenoexcept

◆ deallocate() [2/2]

template<trivial T = char>
void nngn::reallocator< T >::deallocate ( pointer  p,
std::size_t   
)
inlinenoexcept

◆ reallocate() [1/2]

template<trivial T>
auto nngn::reallocator< T >::reallocate ( pointer  p,
std::size_t  n 
)
noexcept

◆ reallocate() [2/2]

template<trivial T = char>
pointer nngn::reallocator< T >::reallocate ( pointer  p,
std::size_t  n 
)
noexcept

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