EASTL
EASTL copied to clipboard
Overriding make_unique and default_delete
There is no way to directly override allocation in make_unique
and default_delete
.
They directly call standard operators, requiring having custom deleters everywhere or editing the source code when integrating EASTL into any project which involves dynamic linking (as overriding new and delete is not supported for DLLs).
Making them use the default allocator is one very simple solution which would at least provide the same allocation as other EASTL types.
make_unique is by definition a utillity to create a new-ed object, which will be deleted by a call to delete. (although eastl::make_unique doesn't perfectly mirror the std::make_unique) the standard proposal that added std::make_unique has a good explanation on why users should simply create their own utility function if they want to use their own allocator & deleter. Specifically, see section 3.4.
Understood. But wouldn't it make more sense to at least make them use the default allocator? This would ensure the entire library has a single default point of allocation, according to the FAQ: EASTL never uses global new / delete / malloc / free. All allocations are done via user-specified allocators, though a default allocator definition is available.