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

Unified Diff: webrtc/base/buffer.h

Issue 2293983002: rtc::Buffer: Let SetData and AppendData accept anything with .data() and .size() (Closed)
Patch Set: Created 4 years, 4 months 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 | webrtc/base/buffer_unittest.cc » ('j') | webrtc/base/buffer_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/buffer.h
diff --git a/webrtc/base/buffer.h b/webrtc/base/buffer.h
index 545ddb2be7cc91df5b2b695948d1610abe9fe331..ecf73adda0ee87f4eb7228c0efd9e35f66dcd8f1 100644
--- a/webrtc/base/buffer.h
+++ b/webrtc/base/buffer.h
@@ -192,7 +192,10 @@ class BufferT {
SetData(array, N);
}
- void SetData(const BufferT& buf) { SetData(buf.data(), buf.size()); }
+ template <typename W>
ossu 2016/08/31 09:31:03 "W" as in Whatever? :)
kwiberg-webrtc 2016/09/01 09:23:53 Yeah, whatever.
+ void SetData(const W& w) {
+ SetData(w.data(), w.size());
+ }
// Replace the data in the buffer with at most |max_elements| of data, using
// the function |setter|, which should have the following signature:
@@ -234,7 +237,12 @@ class BufferT {
AppendData(array, N);
}
- void AppendData(const BufferT& buf) { AppendData(buf.data(), buf.size()); }
+ template <typename W,
+ typename std::enable_if<
+ !internal::BufferCompat<T, W>::value>::type* = nullptr>
+ void AppendData(const W& w) {
+ AppendData(w.data(), w.size());
+ }
template <typename U,
typename std::enable_if<
« no previous file with comments | « no previous file | webrtc/base/buffer_unittest.cc » ('j') | webrtc/base/buffer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698