mirror of
https://github.com/zeldaret/botw
synced 2026-07-07 13:23:40 -04:00
ksys: Document safeDelete and safeDeleteArray
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
|
||||
namespace ksys::util {
|
||||
|
||||
/// Deletes an object that was allocatd with a new expression and sets the pointer to nullptr,
|
||||
/// preventing it from being accidentally reused.
|
||||
/// It is safe for the pointer to be already nullptr.
|
||||
template <typename T>
|
||||
inline void safeDelete(T*& pointer) {
|
||||
if (pointer)
|
||||
@@ -11,6 +14,9 @@ inline void safeDelete(T*& pointer) {
|
||||
pointer = nullptr;
|
||||
}
|
||||
|
||||
/// Deletes an array that was allocatd with a new[] expression and sets the pointer to nullptr,
|
||||
/// preventing it from being accidentally reused.
|
||||
/// It is safe for the pointer to be already nullptr.
|
||||
template <typename T>
|
||||
inline void safeDeleteArray(T*& pointer) {
|
||||
if (pointer)
|
||||
|
||||
Reference in New Issue
Block a user