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

Unified Diff: base/stl_util.h

Issue 1441543002: Make vector_as_array use std::vector::data and switch a few directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use in //base headers too Created 5 years, 1 month 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 | « no previous file | base/trace_event/process_memory_dump.cc » ('j') | 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 e937d2f3ed9157d433cc62fb71958bd9c71cd6d9..848ef777bc7df63ae2e6e42beb07cfdacb4e4c20 100644
--- a/base/stl_util.h
+++ b/base/stl_util.h
@@ -98,9 +98,7 @@ STLCount(const Container& container, const T& val) {
return std::count(container.begin(), container.end(), val);
}
-// To treat a possibly-empty vector as an array, use these functions.
-// If you know the array will never be empty, you can use &*v.begin()
-// directly, but that is undefined behaviour if |v| is empty.
+// Deprecated: Use v.data() instead.
template<typename T>
inline T* vector_as_array(std::vector<T>* v) {
return v->empty() ? NULL : &*v->begin();
Mark Mentovai 2015/11/16 22:16:29 I was expecting based on the review thread to see
danakj 2015/11/16 22:24:44 Oh, it's true we could just use data() here. I don
davidben 2015/11/16 22:57:30 Done.
« no previous file with comments | « no previous file | base/trace_event/process_memory_dump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698