#include "cetl/pmr/memory.hpp"
Public Types | |
| using | allocator = PolymorphicDeallocator |
| using | value_type = typename PolymorphicDeallocator::value_type |
| using | unique_ptr = std::unique_ptr<value_type, cetl::pmr::polymorphic_deleter<PolymorphicDeallocator>> |
Public Member Functions | |
| polymorphic_deleter (const PolymorphicDeallocator &alloc, std::size_t object_count) noexcept(std::is_nothrow_copy_constructible< PolymorphicDeallocator >::value) | |
| polymorphic_deleter (polymorphic_deleter &&rhs) noexcept(std::is_nothrow_move_constructible< PolymorphicDeallocator >::value) | |
| polymorphic_deleter & | operator= (polymorphic_deleter &&rhs) noexcept(std::is_nothrow_move_assignable< PolymorphicDeallocator >::value) |
| polymorphic_deleter (const polymorphic_deleter &rhs) noexcept(std::is_nothrow_copy_constructible< PolymorphicDeallocator >::value) | |
| polymorphic_deleter & | operator= (const polymorphic_deleter &rhs) noexcept(std::is_nothrow_copy_assignable< PolymorphicDeallocator >::value) |
| void | operator() (value_type *p) noexcept |
RAII helper for cetl::pf17::pmr::polymorphic_allocator and std::pmr::polymorphic_allocator.
This type is designed to work with std::unique_ptr but is still cumbersome to use. Use with cetl::pmr::factory for the best and safest experience. Remember, be safe, use the cetl::pmr::factory.
| PolymorphicDeallocator | The type of the polymorphic allocator to use for deallocation. |
| using cetl::pmr::polymorphic_deleter< PolymorphicDeallocator >::allocator = PolymorphicDeallocator |
The allocator type this deleter uses to, uh... delete memory?
| using cetl::pmr::polymorphic_deleter< PolymorphicDeallocator >::unique_ptr = std::unique_ptr<value_type, cetl::pmr::polymorphic_deleter<PolymorphicDeallocator>> |
While this object is simply a functor and could be used with other smart pointers the design is optimized for and tested with this std::unique_ptr type.
| using cetl::pmr::polymorphic_deleter< PolymorphicDeallocator >::value_type = typename PolymorphicDeallocator::value_type |
The type this deleter, you know...deletes? (It is in the name of the class and all)
|
inlinenoexcept |
Designated constructor that copies a given allocator and records the object count to use when deleting the smart pointer resources.
| alloc | The allocator to use when deleting the objects in the smart pointer. |
| object_count | The number of objects in the smart pointer that will be deleted. |
|
inlinenoexcept |
Functor called by smart-pointer to deallocate and deconstruct objects.
| p | The object to deconstruct and deallocate. |