diff --git a/utils/allocation_strategy.hh b/utils/allocation_strategy.hh index b69073bb3d..218dd14dd3 100644 --- a/utils/allocation_strategy.hh +++ b/utils/allocation_strategy.hh @@ -203,6 +203,19 @@ auto current_deleter() { }; } +template +struct alloc_strategy_deleter { + void operator()(T* ptr) const noexcept { + current_allocator().destroy(ptr); + } +}; + +// std::unique_ptr which can be used for owning an object allocated using allocation_strategy. +// Must be destroyed before the pointer is invalidated. For compacting allocators, that +// means it must not escape outside allocating_section or reclaim lock. +// Must be destroyed in the same allocating context in which T was allocated. +template +using alloc_strategy_unique_ptr = std::unique_ptr>; // // Passing allocators to objects.