A Metall STL compatible allocator which fallbacks to a heap allocator (e.g., malloc()) if its constructor receives no argument to construct the stateful allocator (Metall's normal STL compatible allocator) instance.
More...
|
| fallback_allocator_adaptor () noexcept |
| Default constructor which falls back on the regular allocator (i.e., malloc()). More...
|
|
template<typename stateful_allocator_type2 , std::enable_if_t< std::is_constructible< stateful_allocator_type, stateful_allocator_type2 >::value, int > = 0> |
| fallback_allocator_adaptor (fallback_allocator_adaptor< stateful_allocator_type2 > allocator_instance) noexcept |
| Construct a new instance using an instance of fallback_allocator_adaptor with any stateful_allocator type. More...
|
|
template<typename stateful_allocator_type2 , std::enable_if_t< std::is_constructible< stateful_allocator_type, stateful_allocator_type2 >::value, int > = 0> |
| fallback_allocator_adaptor (stateful_allocator_type2 allocator_instance) noexcept |
| Construct a new instance using an instance of any stateful_allocator. More...
|
|
| fallback_allocator_adaptor (const fallback_allocator_adaptor &other) noexcept=default |
| Copy constructor. More...
|
|
| fallback_allocator_adaptor (fallback_allocator_adaptor &&other) noexcept=default |
| Move constructor. More...
|
|
fallback_allocator_adaptor & | operator= (const fallback_allocator_adaptor &) noexcept=default |
| Copy assign operator. More...
|
|
template<typename stateful_allocator_type2 , std::enable_if_t< std::is_constructible< stateful_allocator_type, stateful_allocator_type2 >::value, int > = 0> |
fallback_allocator_adaptor & | operator= (const fallback_allocator_adaptor< stateful_allocator_type2 > &other) noexcept |
| Copy assign operator, using an instance of fallback_allocator_adaptor with any stateful_allocator type. More...
|
|
template<typename stateful_allocator_type2 , std::enable_if_t< std::is_constructible< stateful_allocator_type, stateful_allocator_type2 >::value, int > = 0> |
fallback_allocator_adaptor & | operator= (const stateful_allocator_type2 &allocator_instance) noexcept |
| Copy assign operator for any stateful_allocator. More...
|
|
fallback_allocator_adaptor & | operator= (fallback_allocator_adaptor &&other) noexcept=default |
| Move assign operator. More...
|
|
template<typename stateful_allocator_type2 , std::enable_if_t< std::is_constructible< stateful_allocator_type, stateful_allocator_type2 >::value, int > = 0> |
fallback_allocator_adaptor & | operator= (fallback_allocator_adaptor< stateful_allocator_type2 > &&other) noexcept |
| Move assign operator, using an instance of fallback_allocator_adaptor with any stateful_allocator type. More...
|
|
template<typename stateful_allocator_type2 , std::enable_if_t< std::is_constructible< stateful_allocator_type, stateful_allocator_type2 >::value, int > = 0> |
fallback_allocator_adaptor & | operator= (stateful_allocator_type2 &&allocator_instance) noexcept |
| Move assign operator for any stateful_allocator. More...
|
|
pointer | allocate (const size_type n) const |
| Allocates n * sizeof(T) bytes of storage. More...
|
|
void | deallocate (pointer ptr, const size_type size) const |
| Deallocates the storage reference by the pointer ptr. More...
|
|
size_type | max_size () const noexcept |
| The size of the theoretical maximum allocation size. More...
|
|
template<class... Args> |
void | construct (const pointer &ptr, Args &&...args) const |
| Constructs an object of T. More...
|
|
void | destroy (const pointer &ptr) const |
| Deconstruct an object of T. More...
|
|
stateful_allocator_type & | get_stateful_allocator () |
| Returns a reference to the stateful allocator. More...
|
|
const stateful_allocator_type & | get_stateful_allocator () const |
| Returns a const reference to the stateful allocator. More...
|
|
bool | stateful_allocator_available () const |
| Returns true if the stateful allocator is available. More...
|
|
template<typename StatefulAllocator>
class metall::container::fallback_allocator_adaptor< StatefulAllocator >
A Metall STL compatible allocator which fallbacks to a heap allocator (e.g., malloc()) if its constructor receives no argument to construct the stateful allocator (Metall's normal STL compatible allocator) instance.
- Template Parameters
-
StatefulAllocator | The stateful allocator type. It must not be default constructible. |