mirror of https://github.com/zeldaret/botw.git
ksys: Document safeDelete and safeDeleteArray
This commit is contained in:
parent
ce1b6900ab
commit
808b21530a
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue