Added an operator[] to Buffer, to make reading data easier.
Review URL: https://codereview.webrtc.org/1745033002 Cr-Commit-Position: refs/heads/master@{#11819}
This commit is contained in:
@ -124,6 +124,16 @@ class Buffer {
|
||||
|
||||
bool operator!=(const Buffer& buf) const { return !(*this == buf); }
|
||||
|
||||
uint8_t& operator[](size_t index) {
|
||||
RTC_DCHECK_LT(index, size_);
|
||||
return data()[index];
|
||||
}
|
||||
|
||||
uint8_t operator[](size_t index) const {
|
||||
RTC_DCHECK_LT(index, size_);
|
||||
return data()[index];
|
||||
}
|
||||
|
||||
// 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>
|
||||
|
||||
Reference in New Issue
Block a user