aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/SplitVector.h
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-07-15 14:04:44 +1000
committerNeil <nyamatongwe@gmail.com>2021-07-15 14:04:44 +1000
commit65ea703cfbf8d5660c59e8b1ab756ed7ddde50a9 (patch)
treee58a68dcffce08cd7dadc1686d592896d5b90c28 /src/SplitVector.h
parent0a5f16edd287fba222214b89661285191e7af898 (diff)
downloadscintilla-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.h10
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;