summaryrefslogtreecommitdiff
path: root/include/stdalgo.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/stdalgo.h')
-rw-r--r--include/stdalgo.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/stdalgo.h b/include/stdalgo.h
index 683b2655b..578618132 100644
--- a/include/stdalgo.h
+++ b/include/stdalgo.h
@@ -182,6 +182,17 @@ namespace stdalgo
std::for_each(cont.begin(), cont.end(), defaultdeleter<T>());
}
+ /** Deletes a object and zeroes the memory location that pointed to it.
+ * @param pr A reference to the pointer that contains the object to delete.
+ */
+ template<typename T>
+ void delete_zero(T*& pr)
+ {
+ T* p = pr;
+ pr = NULL;
+ delete p;
+ }
+
/**
* Remove an element from a container
* @param cont Container to remove the element from