acl/core/unique_ptr.h¶
#include "acl/core/unique_ptr.h"
The std::unique_ptr helpers for memory that an iallocator allocates.
deleter¶
template<typename allocated_type>
class deleter
The deleter of a std::unique_ptr that an iallocator allocated. It destroys the instance and releases its memory with the allocator.
deleter::deleter¶
explicit deleter(iallocator& allocator) noexcept
Constructs a deleter that releases the memory with the given allocator.
deleter(const deleter&) noexcept = default
deleter(deleter&&) noexcept = default
Copies the allocator of another deleter.
deleter::operator=¶
deleter& operator=(const deleter&) noexcept = default
deleter& operator=(deleter&&) noexcept = default
Copies the allocator of another deleter.
deleter::operator()¶
void operator()(allocated_type* ptr)
Destroys the instance and releases its memory. A null pointer does nothing.
make_unique¶
template<typename allocated_type, typename... args>
std::unique_ptr<allocated_type, deleter<allocated_type>> make_unique(
iallocator& allocator,
args&&... arguments)
Allocates an instance of a type with the allocator and returns it in a std::unique_ptr. The deleter of the std::unique_ptr releases the memory with the same allocator.
make_unique_aligned¶
template<typename allocated_type, typename... args>
std::unique_ptr<allocated_type, deleter<allocated_type>> make_unique_aligned(
iallocator& allocator,
size_t alignment,
args&&... arguments)
Allocates an instance of a type with the given alignment and returns it in a std::unique_ptr. The deleter of the std::unique_ptr releases the memory with the same allocator.