Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1811)

Unified Diff: base/stl_util.h

Issue 2579693003: Remove STLDeleteElements. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/stl_util.h
diff --git a/base/stl_util.h b/base/stl_util.h
index 3f7555dde5450052dfc9c930c3c444fe7a9a77f8..fef3eaa6430a32b2018922e49f5946cc2313b718 100644
--- a/base/stl_util.h
+++ b/base/stl_util.h
@@ -54,29 +54,9 @@ inline char* string_as_array(std::string* str) {
return str->empty() ? NULL : &*str->begin();
}
-// The following functions are useful for cleaning up STL containers whose
+// The following function is useful for cleaning up STL containers whose
// elements point to allocated memory.
-// STLDeleteElements() deletes all the elements in an STL container and clears
-// the container. This function is suitable for use with a vector, set,
-// hash_set, or any other STL container which defines sensible begin(), end(),
-// and clear() methods.
-//
-// If container is NULL, this function is a no-op.
-template <class T>
-void STLDeleteElements(T* container) {
- if (!container)
- return;
-
- for (auto it = container->begin(); it != container->end();) {
- auto temp = it;
- ++it;
- delete *temp;
- }
-
- container->clear();
-}
-
// Given an STL container consisting of (key, value) pairs, STLDeleteValues
// deletes all the "value" components and clears the container. Does nothing
// in the case it's given a NULL pointer.
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698