diff options
author | Neil <nyamatongwe@gmail.com> | 2021-07-15 14:04:44 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-07-15 14:04:44 +1000 |
commit | 65ea703cfbf8d5660c59e8b1ab756ed7ddde50a9 (patch) | |
tree | e58a68dcffce08cd7dadc1686d592896d5b90c28 /src/SplitVector.h | |
parent | 0a5f16edd287fba222214b89661285191e7af898 (diff) | |
download | scintilla-mirror-65ea703cfbf8d5660c59e8b1ab756ed7ddde50a9.tar.gz |
Feature [feature-requests:#1381] Move SplitView to header so it can be used more
widely.
Ensure that case where all text is after the gap is as efficient as when all
text is before the gap.
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; |