CustomSTLAllocator< T > Class Template Reference

#include <customstlallocator.h>

详细描述

template<typename T>
class maxon::CustomSTLAllocator< T >

Custom STL C++11 allocator that wraps maxon::DefaultAllocator .

Classes

struct   rebind

Public Types

using  value_type = T
using  pointer = T *
using  const_pointer = const T *
using  reference = T &
using  const_reference = const T &
using  size_type = std::size_t
using  difference_type = std::ptrdiff_t

公共成员函数

  CustomSTLAllocator () noexcept
  CustomSTLAllocator (const CustomSTLAllocator &) noexcept
template<typename U >
  CustomSTLAllocator (const CustomSTLAllocator < U > &) noexcept
T *  allocate (std::size_t n) noexcept
void  deallocate (T *p, std::size_t) noexcept
void  construct (T *p, const T &value)
void  destroy (T *p)

Member Typedef Documentation

◆  value_type

using value_type = T

type definitions required for custom allocator

◆  pointer

using pointer = T*

◆  const_pointer

using const_pointer = const T*

◆  reference

using reference = T&

◆  const_reference

using const_reference = const T&

◆  size_type

using size_type = std::size_t

◆  difference_type

using difference_type = std::ptrdiff_t

构造函数 & 析构函数文档编制

◆  CustomSTLAllocator() [1/3]

CustomSTLAllocator ( )
noexcept

◆  CustomSTLAllocator() [2/3]

CustomSTLAllocator ( const CustomSTLAllocator < T > &  )
noexcept

◆  CustomSTLAllocator() [3/3]

CustomSTLAllocator ( const CustomSTLAllocator < U > &  )
noexcept

成员函数文档编制

◆  allocate()

T* allocate ( std::size_t  n )
noexcept

Allocates storage for n values of T.

◆  deallocate()

void deallocate ( T *  p ,
std::size_t   
)
noexcept

Deallocates storage obtained by a call to allocate() .

◆  construct()

void construct ( T *  p ,
const T &  value  
)

Constructs an object of type T at the location of p, using the value of value in the call to the constructor for T.

◆  destroy()

void destroy ( T *  p )

Calls the destructor on the value pointed to by p.