summaryrefslogtreecommitdiff
path: root/deimos/core
diff options
context:
space:
mode:
Diffstat (limited to 'deimos/core')
-rw-r--r--deimos/core/allocator.h13
1 files changed, 13 insertions, 0 deletions
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>{ (T*)raw, count };
}
+
+ template<typename T>
+ void DeleteArray(gsl::owner<Span<T>> arr, const SourceLocation& source_location = {})
+ {
+ if constexpr (!std::is_trivially_destructible_v<T>)
+ {
+ for (T* p = arr.data(), end = arr.end(); p < end; ++p)
+ {
+ p->~T();
+ }
+ }
+ Free(arr.data(), arr.size_bytes(), source_location);
+ }
};
class AllocatorApi