I am trying to use std::unique_ptr with custom memory allocators. Basically, I have custom allocators that are subclasses of IAllocator,
std::unique_ptr
IAllocator
Yes, there most certainly is a better way: Use a maker-function.
template std::unique_ptr my_maker(size_t count, A&& allocator) { return {somePtr(allocator.AllocArray(count), MyArrDeleter(allocator, count)}; } auto p = my_maker(42, allocator);