[jumbo] Add begin()/end() to DetachedBuffer. (#8370)

This allows this type to meet the requirements of e.g.
std::ranges::range, which is necessary for it to work with the
std::span range constructor, or the "non-legacy" constructor for
Chromium's base::span.

Bug: none

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
pkasting 2024-08-19 21:12:35 -07:00 committed by GitHub
parent 7833affd7e
commit 42879f6ea6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -80,6 +80,11 @@ class DetachedBuffer {
size_t size() const { return size_; }
uint8_t *begin() { return data(); }
const uint8_t *begin() const { return data(); }
uint8_t *end() { return data() + size(); }
const uint8_t *end() const { return data() + size(); }
// These may change access mode, leave these at end of public section
FLATBUFFERS_DELETE_FUNC(DetachedBuffer(const DetachedBuffer &other));
FLATBUFFERS_DELETE_FUNC(