template <typename T>
using allocator_t = cetl::pmr::polymorphic_allocator<T>;
template <typename T>
using dark_ptr_t = std::unique_ptr<T, cetl::pmr::PolymorphicDeleter<allocator_t<T>>>;
/// Construct a new concrete type but return a unique_ptr to an interface type for the concrete object.
/// Because the concrete type is no longer visible, except by using RTTI or IPolymorphicType, after the
/// pointer is constructed it is referred to as a "Dark" pointer.
template <typename InterfaceType, typename ConcreteType, typename... Args>
static dark_ptr_t<InterfaceType> make_unique(allocator_t<ConcreteType> concrete_allocator, Args&&... args)
{
...
One of the dangers of the dark pointer is, if a user calls release the object returned cannot be safely deleted unless the caller also gets the deleter. It might be worth encapsulating std::unique_ptr to account for this danger?
One of the dangers of the dark pointer is, if a user calls
release
the object returned cannot be safely deleted unless the caller also gets the deleter. It might be worth encapsulating std::unique_ptr to account for this danger?