40 void (*free)(
void *data);
50 template<
typename T> T *
add(std::unique_ptr<T> resource);
52 void add(
void *userdata,
void (*
free)(
void *));
54 template<
typename T> T &
add_value(T &&value);
57 template<
typename T,
typename... Args> T &
construct(Args &&...args);
72 T *
ptr = resource.release();
76 this->
add(ptr, [](
void *data) {
77 T *typed_data =
reinterpret_cast<T *
>(
data);
89 T *
ptr = resource.release();
94 if constexpr (std::is_trivially_destructible_v<T>) {
98 this->
add(ptr, [](
void *data) {
99 T *typed_data =
reinterpret_cast<T *
>(
data);
112 data.data = userdata;
131 void *buffer = allocator_.
allocate(
sizeof(Func),
alignof(Func));
132 new (buffer) Func(std::move(func));
133 this->
add(buffer, [](
void *data) { (*
static_cast<Func *
>(
data))(); });
142 T &value_ref = *value_ptr;
143 this->
add(std::move(value_ptr));
void BLI_kdtree_nd_ free(KDTree *tree)
destruct_ptr< T > construct(Args &&...args)
void * allocate(const int64_t size, const int64_t alignment)
T & construct(Args &&...args)
void add_destruct_call(Func func)
LinearAllocator & linear_allocator()
T * add(std::unique_ptr< T > resource)
void append(const T &value)
std::unique_ptr< T, DestructValueAtAddress< T > > destruct_ptr