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

Unified Diff: webrtc/base/buffer.h

Issue 1745033002: Added an operator[] to Buffer, to make reading data easier. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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') | no next file with comments »
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 0ef1e3b5c8a70a99068cbcf2ce32ac5e5da8d06f..aabd6d6ec4b4bd7ec226ea6f35f410052c4d2ca1 100644
--- a/webrtc/base/buffer.h
+++ b/webrtc/base/buffer.h
@@ -124,6 +124,9 @@ class Buffer {
bool operator!=(const Buffer& buf) const { return !(*this == buf); }
+ uint8_t& operator[](size_t index) { return data()[index]; }
+ uint8_t operator[](size_t index) const { return data()[index]; }
kwiberg-webrtc 2016/02/29 12:40:46 It's probably a good idea to DCHECK that the index
ossu 2016/02/29 12:48:53 Acknowledged.
+
// The SetData functions replace the contents of the buffer. They accept the
// same input types as the constructors.
template <typename T, typename internal::ByteType<T>::t = 0>
« no previous file with comments | « no previous file | webrtc/base/buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698