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 198 of file stdcontainerallocator.inl.
Public Field Index: | |
| RTTRAllocator< TAllocator > & | recycler |
| The only member of this allocator type used to perform all duties. | |
Public Method Index: | |
| constexpr | StdContainerAllocatorRecycling (const StdContainerAllocatorRecycling &) noexcept=default |
| Defaulted copy constructor. | |
| constexpr | StdContainerAllocatorRecycling (RTTRAllocator< TAllocator > &pRecycler) |
| constexpr | StdContainerAllocatorRecycling (StdContainerAllocatorRecycling &&) noexcept=default |
| Defaulted move constructor. | |
| template<typename TSibling> | |
| StdContainerAllocatorRecycling (TSibling &StdContainerAllocatorRecycling) | |
| T * | allocate (size_t n, const void *=nullptr) |
| void | deallocate (T *p, std::size_t n) |
| template<typename U> | |
| bool | operator!= (const StdContainerAllocatorRecycling< U, TAllocator > &rhs) const noexcept |
| template<typename U> | |
| bool | operator== (const StdContainerAllocatorRecycling< U, TAllocator > &rhs) const noexcept |
Additional Inherited Members | |
Public Type Index: inherited from alib::lang::detail::StdContainerAllocatorBase< T, TAllocator > | |
| using | AllocatorType = TAllocator |
| The allocator type that TAllocator specifies. | |
| 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. | |
| RTTRAllocator<TAllocator>& alib::lang::StdContainerAllocatorRecycling< T, TAllocator >::recycler |
The only member of this allocator type used to perform all duties.
Definition at line 204 of file stdcontainerallocator.inl.
|
inline |
Copy constructor using an instance of different template type.
| TSibling | The originating allocator's type (StdContainerAllocatorRecycling<X>). |
| StdContainerAllocatorRecycling | The originating allocator of type TSibling . |
Definition at line 219 of file stdcontainerallocator.inl.
|
inlineconstexpr |
Constructor for the initial allocator instantiation.
| pRecycler | The recycler to for allocations and de-allocations. |
Definition at line 224 of file stdcontainerallocator.inl.
|
inlinenodiscard |
Implementation of std::allocator interface. Dependent on whether a single or multiple objects are requested, this method invokes either RTTRAllocator::Get or RTTRAllocator::AllocUnrelated on field recycler.
| n | The number of requested objects to allocate storage for. |
Definition at line 260 of file stdcontainerallocator.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 281 of file stdcontainerallocator.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 244 of file stdcontainerallocator.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 236 of file stdcontainerallocator.inl.