|
Flow
Documentation for the Flow C++ Library
|
Polymorphic allocator wrapping a non-owning memory resource. Allocation strategy depends on the memory resource implementation. More...
#include <flow_polymorphic_allocator.h>
Public Types | |
| using | value_type = T |
Public Member Functions | |
| PolymorphicAllocator () noexcept | |
| Default constructor using the default memory resource. | |
| PolymorphicAllocator (MemoryResource &resource) noexcept | |
| Construct allocator with a specific memory resource. | |
| template<typename U> | |
| PolymorphicAllocator (const PolymorphicAllocator< U > &allocator) noexcept | |
| Copy constructor from another polymorphic allocator. | |
| T * | allocate (std::size_t count) |
| Allocate memory for count objects. | |
| void | deallocate (T *address, std::size_t count) noexcept |
| Deallocate memory. | |
| template<typename U, typename... Args> | |
| void | construct (U *address, Args &&... args) |
| Construct an object in place at the given address. | |
| template<typename U> | |
| void | destroy (U *address) noexcept |
| Destroy the object at the given address. | |
Private Attributes | |
| MemoryResource * | resource_ |
Friends | |
| template<typename U> | |
| class | PolymorphicAllocator |
| Non-owning pointer to memory resource. | |
| template<typename U> | |
| bool | operator== (const PolymorphicAllocator< T > &lhs, const PolymorphicAllocator< U > &rhs) noexcept |
| template<typename U> | |
| bool | operator!= (const PolymorphicAllocator< T > &lhs, const PolymorphicAllocator< U > &rhs) noexcept |
Polymorphic allocator wrapping a non-owning memory resource. Allocation strategy depends on the memory resource implementation.
Definition at line 10 of file flow_polymorphic_allocator.h.
| using flow::PolymorphicAllocator< T >::value_type = T |
Definition at line 12 of file flow_polymorphic_allocator.h.
|
inlinenoexcept |
Default constructor using the default memory resource.
Definition at line 15 of file flow_polymorphic_allocator.h.
References resource_.
|
inlineexplicitnoexcept |
Construct allocator with a specific memory resource.
| resource | Memory resource to use. |
Definition at line 21 of file flow_polymorphic_allocator.h.
|
inlinenoexcept |
Copy constructor from another polymorphic allocator.
| allocator | Another allocator to copy from. |
Definition at line 28 of file flow_polymorphic_allocator.h.
References PolymorphicAllocator.
|
inline |
Allocate memory for count objects.
| count | Number of objects to allocate. |
Definition at line 35 of file flow_polymorphic_allocator.h.
References resource_.
|
inline |
Construct an object in place at the given address.
| U | Type of object to construct. |
| address | Pointer to memory. |
| args | Constructor arguments. |
Definition at line 51 of file flow_polymorphic_allocator.h.
|
inlinenoexcept |
Deallocate memory.
| address | Pointer to memory to deallocate. |
| count | Number of objects previously allocated. |
Definition at line 42 of file flow_polymorphic_allocator.h.
References resource_.
|
inlinenoexcept |
Destroy the object at the given address.
| address | Pointer to object to destroy. |
Definition at line 58 of file flow_polymorphic_allocator.h.
|
friend |
Definition at line 74 of file flow_polymorphic_allocator.h.
References PolymorphicAllocator.
|
friend |
Definition at line 69 of file flow_polymorphic_allocator.h.
References PolymorphicAllocator.
Non-owning pointer to memory resource.
Definition at line 66 of file flow_polymorphic_allocator.h.
References PolymorphicAllocator.
Referenced by operator!=, operator==, PolymorphicAllocator(), and PolymorphicAllocator.
|
private |
Definition at line 63 of file flow_polymorphic_allocator.h.
Referenced by allocate(), deallocate(), and PolymorphicAllocator().