50 template<
typename T>
T *
add(std::unique_ptr<T> resource);
52 void add(
void *userdata,
void (*
free)(
void *));
57 template<
typename T,
typename... Args>
T &
construct(Args &&...args);
72 T *
ptr = resource.release();
77 T *typed_data =
reinterpret_cast<T *
>(
data);
89 T *
ptr = resource.release();
94 if constexpr (std::is_trivially_destructible_v<T>) {
99 T *typed_data =
reinterpret_cast<T *
>(
data);
112 data.data = userdata;
114 resources_.append(
data);
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))(); });
141 destruct_ptr<T> value_ptr = allocator_.construct<
T>(std::forward<Args>(args)...);
142 T &value_ref = *value_ptr;
143 this->
add(std::move(value_ptr));
void BLI_kdtree_nd_ free(KDTree *tree)
NonCopyable(const NonCopyable &other)=delete
NonMovable(NonMovable &&other)=delete
T & construct(Args &&...args)
void add_destruct_call(Func func)
LinearAllocator & linear_allocator()
T * add(std::unique_ptr< T > resource)
std::unique_ptr< T, DestructValueAtAddress< T > > destruct_ptr