From 1ba21eb06339be822ab2074285efb6f2fdd6e2e9 Mon Sep 17 00:00:00 2001 From: kwiberg Date: Wed, 5 Apr 2017 07:38:06 -0700 Subject: [PATCH] Add [c]begin() and [c]end() member functions to rtc::Buffer I can't believe it's been this long before I found out we didn't have them... BUG=none Review-Url: https://codereview.webrtc.org/2804673002 Cr-Commit-Position: refs/heads/master@{#17544} --- webrtc/base/buffer.h | 7 +++++++ webrtc/base/buffer_unittest.cc | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/webrtc/base/buffer.h b/webrtc/base/buffer.h index 44f941eb60..85e6efb74e 100644 --- a/webrtc/base/buffer.h +++ b/webrtc/base/buffer.h @@ -179,6 +179,13 @@ class BufferT { return data()[index]; } + T* begin() { return data(); } + T* end() { return data() + size(); } + const T* begin() const { return data(); } + const T* end() const { return data() + size(); } + const T* cbegin() const { return data(); } + const T* cend() const { return data() + size(); } + // The SetData functions replace the contents of the buffer. They accept the // same input types as the constructors. template buf(test_data);