From 03c746d8a6c26915b11af1a24ad3ebd94d453800 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Fri, 14 Jun 2024 18:38:48 +0200 Subject: Command buffer submission --- deimos/core/allocator.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'deimos/core') diff --git a/deimos/core/allocator.h b/deimos/core/allocator.h index f6adea2..569b0df 100644 --- a/deimos/core/allocator.h +++ b/deimos/core/allocator.h @@ -188,6 +188,19 @@ public: } return Span{ (T*)raw, count }; } + + template + void DeleteArray(gsl::owner> arr, const SourceLocation& source_location = {}) + { + if constexpr (!std::is_trivially_destructible_v) + { + for (T* p = arr.data(), end = arr.end(); p < end; ++p) + { + p->~T(); + } + } + Free(arr.data(), arr.size_bytes(), source_location); + } }; class AllocatorApi -- cgit