12#include "vecmem/memory/memory_resource.hpp"
46 static_assert(!std::is_array_v<T> ||
47 (std::is_array_v<T> && std::extent_v<T> == 0),
48 "Pointer type of unique object must be either non-array or "
49 "unbound array type.");
52 std::conditional_t<std::is_array_v<T>, std::decay_t<T>,
T*>;
53 using storage_t = std::remove_pointer_t<pointer_t>;
81 : m_mr(&
mr), m_size(
s), m_align(
a), m_elems(
n) {}
125 assert(m_mr !=
nullptr || m_size == 0
u);
138 if constexpr (!std::is_array_v<T>) {
144 }
else if constexpr (std::is_array_v<T>) {
149 for (std::size_t
i = 0;
i < m_elems; ++
i) {
159 m_mr->deallocate(
p, m_size, m_align);
161 m_mr->deallocate(
p, m_size);
172 memory_resource* m_mr;
Namespace for types that should not be used directly by clients.
Definition array.hpp:23
std::vector< T, vecmem::polymorphic_allocator< T > > vector
Alias type for vectors with our polymorphic allocator.
Definition vector.hpp:35
A deleter class for non-trivial objects.
Definition unique_obj_deleter.hpp:44
void operator()(pointer_t p) const
Activate the deletion mechanism of the deleter.
Definition unique_obj_deleter.hpp:124
unique_obj_deleter(memory_resource &mr, std::size_t s, std::size_t a=0, std::size_t n=1)
Construct a new unique object deleter.
Definition unique_obj_deleter.hpp:79
unique_obj_deleter(unique_obj_deleter &&i)=default
Move a unique object deleter.
unique_obj_deleter & operator=(const unique_obj_deleter &i)=default
Copy-assign a unique object deleter.
unique_obj_deleter(void)=default
Default-construct a new unique object deleter.
unique_obj_deleter(const unique_obj_deleter &i)=default
Copy a unique object deleter.
unique_obj_deleter & operator=(unique_obj_deleter &&i)=default
Move-assign a unique object deleter.