Implementation of std::allocator to be used with container types provided by the C++ standard library.
As the C+++ library's specification does not include details of the container class's implementation, this allocator uses type RTTRAllocator which detects node types automatically.
| T | The type of objects to be allocated. |
| TAllocator | The allocator type, as prototyped with Allocator. |
Definition at line 1202 of file allocation.inl.
Public Type Index: | |
| using | AllocatorType = TAllocator |
| Exposes template parameter TAllocator. | |
| using | const_reference = const T& |
| Type definition as required by C++ library standards. | |
| using | difference_type = ptrdiff_t |
| Type definition as required by C++ library standards. | |
| using | is_always_equal = std::false_type |
| Type definition as required by C++ library standards. | |
| using | reference = T& |
| Type definition as required by C++ library standards. | |
| using | size_type = size_t |
| Type definition as required by C++ library standards. | |
| using | value_type = T |
| Type definition as required by C++ library standards. | |
Public Field Index: | |
| RTTRAllocator< TAllocator > & | recycler |
| The only member of this allocator type used to perform all duties. | |
Public Method Index: | |
| constexpr | StdRecyclingAllocator (const StdRecyclingAllocator &) noexcept=default |
| Defaulted copy constructor. | |
| constexpr | StdRecyclingAllocator (RTTRAllocator< TAllocator > &pRecycler) |
| constexpr | StdRecyclingAllocator (StdRecyclingAllocator &&) noexcept=default |
| Defaulted move constructor. | |
| template<typename TSibling> | |
| StdRecyclingAllocator (TSibling &StdRecyclingAllocator) | |
| T * | allocate (size_t n) |
| void | deallocate (T *p, std::size_t n) |
| template<typename U> | |
| bool | operator!= (const StdRecyclingAllocator< U, TAllocator > &rhs) const noexcept |
| template<typename U> | |
| bool | operator== (const StdRecyclingAllocator< U, TAllocator > &rhs) const noexcept |
| using alib::lang::StdRecyclingAllocator< T, TAllocator >::AllocatorType = TAllocator |
Exposes template parameter TAllocator.
Definition at line 1213 of file allocation.inl.
| using alib::lang::StdRecyclingAllocator< T, TAllocator >::const_reference = const T& |
Type definition as required by C++ library standards.
Definition at line 1212 of file allocation.inl.
| using alib::lang::StdRecyclingAllocator< T, TAllocator >::difference_type = ptrdiff_t |
Type definition as required by C++ library standards.
Definition at line 1208 of file allocation.inl.
| using alib::lang::StdRecyclingAllocator< T, TAllocator >::is_always_equal = std::false_type |
Type definition as required by C++ library standards.
Definition at line 1210 of file allocation.inl.
| using alib::lang::StdRecyclingAllocator< T, TAllocator >::reference = T& |
Type definition as required by C++ library standards.
Definition at line 1211 of file allocation.inl.
| using alib::lang::StdRecyclingAllocator< T, TAllocator >::size_type = size_t |
Type definition as required by C++ library standards.
Definition at line 1207 of file allocation.inl.
| using alib::lang::StdRecyclingAllocator< T, TAllocator >::value_type = T |
Type definition as required by C++ library standards.
Definition at line 1209 of file allocation.inl.
| RTTRAllocator<TAllocator>& alib::lang::StdRecyclingAllocator< T, TAllocator >::recycler |
The only member of this allocator type used to perform all duties.
Definition at line 1219 of file allocation.inl.
|
inline |
Copy constructor using an instance of a different template type.
| TSibling | The originating allocator's type (StdRecyclingAllocator<X>). |
| StdRecyclingAllocator | The originating allocator of type TSibling . |
Definition at line 1234 of file allocation.inl.
|
inlineconstexpr |
Constructor for the initial allocator instantiation.
| pRecycler | The recycler to for allocations and deallocations. |
Definition at line 1239 of file allocation.inl.
|
inlinenodiscard |
Implementation of std::allocator interface. Dependent on whether a single or multiple object is requested, this method invokes either RTTRAllocator::Get or RTTRAllocator::AllocUnrelated on the field recycler.
| n | The number of requested objects to allocate storage for. |
Definition at line 1272 of file allocation.inl.
|
inline |
Implementation of std::allocator interface. Dependent on whether a single or multiple objects are de-allocated (parameter n), this method invokes either RTTRAllocator::Recycle or RTTRAllocator::RecycleChunk on field recycler.
| p | Pointer to the object to deallocate. |
| n | The number of objects to de-allocate. |
Definition at line 1290 of file allocation.inl.
|
inlinenoexcept |
Comparison operator.
| U | The allocation type of the other allocator. |
| rhs | The right-hand side allocator. |
false if this and rhs use the same recycler, true otherwise. Definition at line 1258 of file allocation.inl.
|
inlinenoexcept |
Comparison operator.
| U | The allocation type of the other allocator. |
| rhs | The right-hand side allocator. |
true if this and rhs use the same recycler, false otherwise. Definition at line 1250 of file allocation.inl.