Skip to content

Commit 73013d1

Browse files
committed
Merge #45: [jumbo] Add begin()/end() to Slice.
be4dfc9 [jumbo] Add begin()/end() to Slice. (Peter Kasting) Pull request description: 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 (cherry picked from commit 2cc36eb) ACKs for top commit: l0rinc: ACK be4dfc9 dergoegge: Code review ACK be4dfc9 Tree-SHA512: 3f5fad386bc664a84f746226b26eb471e1052e70ef48be8aafd74d0d09381a57ea07074ab3850c96377cff1c180423024383cedcfe11745a93cc685c10fb60dd
2 parents 688561c + be4dfc9 commit 73013d1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/leveldb/slice.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class LEVELDB_EXPORT Slice {
5252
// Return true iff the length of the referenced data is zero
5353
bool empty() const { return size_ == 0; }
5454

55+
const char* begin() const { return data(); }
56+
const char* end() const { return data() + size(); }
57+
5558
// Return the ith byte in the referenced data.
5659
// REQUIRES: n < size()
5760
char operator[](size_t n) const {

0 commit comments

Comments
 (0)