From 2d1616af60fa9c7ee8c8cd191df74c23d37c9ea1 Mon Sep 17 00:00:00 2001 From: docentYT <63965954+docentYT@users.noreply.github.com> Date: Fri, 1 May 2026 18:47:52 +0200 Subject: [PATCH] SafeDelete template type set to pointer --- utilities/utilities.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utilities/utilities.h b/utilities/utilities.h index d715c1c8..11340874 100644 --- a/utilities/utilities.h +++ b/utilities/utilities.h @@ -230,13 +230,14 @@ std::ptrdiff_t len_common_prefix(std::string_view a, std::string_view b); bool contains(std::string_view const String, std::string_view Substring); bool contains(std::string_view const String, char Character); -template void SafeDelete(Type_ &Pointer) +// TODO: Ideally unique_ptr should be used instead of this (not safe) inline functions +template inline void SafeDelete(T* &Pointer) { delete Pointer; Pointer = nullptr; } -template void SafeDeleteArray(Type_ &Pointer) +template inline void SafeDeleteArray(T *&Pointer) { delete[] Pointer; Pointer = nullptr;