Foundation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Attributes | Friends | List of all members
Foundation::Core::StlAllocator< T > Class Template Reference

std::allocator adaptor for Foundation::Core::Allocator More...

#include <Allocator.hpp>

Classes

struct  Rebind
 

Public Types

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

Public Member Functions

 StlAllocator (Allocator *resource) noexcept
 
template<typename U >
 StlAllocator (const StlAllocator< U > &other) noexcept
 
pointer allocate (size_type n)
 
void deallocate (pointer p, size_type n) noexcept
 
void deallocate (pointer p) noexcept
 

Private Attributes

AllocatormResource
 

Friends

template<typename U >
class StlAllocator
 
bool operator== (const StlAllocator &lhs, const StlAllocator &rhs) noexcept
 
bool operator!= (const StlAllocator &lhs, const StlAllocator &rhs) noexcept
 

Detailed Description

template<typename T = void>
class Foundation::Core::StlAllocator< T >

std::allocator adaptor for Foundation::Core::Allocator

Construction without a Foundation::Core::Allocator pointer is disallowed, and will result in a compile-time error. For STL types that require default-constructible allocators, use StlAllocator<void> and pass the resource explicitly

Rebind construction is supported.

Using this with e.g. Foundation::Core::Vector can be done as follows:

Allocator* resource = ...;
Vector<int> vector(resource);
General Purpose Allocator (GPA) interface.
Definition Allocator.hpp:24
std::unique_ptr< T, StlDeleter< T > > UniquePtr
std::unique_ptr with custom deleter that uses a Foundation::Core::Allocator to deallocate memory.
Definition Allocator.hpp:161

Member Typedef Documentation

◆ const_pointer

template<typename T = void>
using Foundation::Core::StlAllocator< T >::const_pointer = const T*

◆ const_reference

template<typename T = void>
using Foundation::Core::StlAllocator< T >::const_reference = const T&

◆ difference_type

template<typename T = void>
using Foundation::Core::StlAllocator< T >::difference_type = std::ptrdiff_t

◆ pointer

template<typename T = void>
using Foundation::Core::StlAllocator< T >::pointer = T*

◆ reference

template<typename T = void>
using Foundation::Core::StlAllocator< T >::reference = T&

◆ size_type

template<typename T = void>
using Foundation::Core::StlAllocator< T >::size_type = std::size_t

◆ value_type

template<typename T = void>
using Foundation::Core::StlAllocator< T >::value_type = T

Constructor & Destructor Documentation

◆ StlAllocator() [1/2]

template<typename T = void>
Foundation::Core::StlAllocator< T >::StlAllocator ( Allocator resource)
inlinenoexcept

◆ StlAllocator() [2/2]

template<typename T = void>
template<typename U >
Foundation::Core::StlAllocator< T >::StlAllocator ( const StlAllocator< U > &  other)
inlinenoexcept

Member Function Documentation

◆ allocate()

template<typename T = void>
pointer Foundation::Core::StlAllocator< T >::allocate ( size_type  n)
inline

◆ deallocate() [1/2]

template<typename T = void>
void Foundation::Core::StlAllocator< T >::deallocate ( pointer  p)
inlinenoexcept

◆ deallocate() [2/2]

template<typename T = void>
void Foundation::Core::StlAllocator< T >::deallocate ( pointer  p,
size_type  n 
)
inlinenoexcept

Friends And Related Symbol Documentation

◆ operator!=

template<typename T = void>
bool operator!= ( const StlAllocator< T > &  lhs,
const StlAllocator< T > &  rhs 
)
friend

◆ operator==

template<typename T = void>
bool operator== ( const StlAllocator< T > &  lhs,
const StlAllocator< T > &  rhs 
)
friend

◆ StlAllocator

template<typename T = void>
template<typename U >
friend class StlAllocator
friend

Member Data Documentation

◆ mResource

template<typename T = void>
Allocator* Foundation::Core::StlAllocator< T >::mResource
private

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