diff options
Diffstat (limited to 'src/SplitVector.h')
-rw-r--r-- | src/SplitVector.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/SplitVector.h b/src/SplitVector.h index 2b4aed4be..885055bd1 100644 --- a/src/SplitVector.h +++ b/src/SplitVector.h @@ -328,6 +328,16 @@ public: } } + /// Return a pointer to a single element. + /// Does not rearrange the buffer. + const T *ElementPointer(ptrdiff_t position) const noexcept { + if (position < part1Length) { + return body.data() + position; + } else { + return body.data() + position + gapLength; + } + } + /// Return the position of the gap within the buffer. ptrdiff_t GapPosition() const noexcept { return part1Length; |