diff options
| author | Maxime Coste <mawww@kakoune.org> | 2024-12-03 21:29:47 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-12-03 21:31:07 +1100 |
| commit | 19f23e0ff81d4b97a7b95567e7ce6f3b49bac81d (patch) | |
| tree | 725ffd05924275dd35c3bde7454e1a52c5d84ea2 /src/buffer.hh | |
| parent | d29fa04adc6a15c8d62ffcd4390e5fc785d92b62 (diff) | |
Compact BufferIterator to avoid padding
Diffstat (limited to 'src/buffer.hh')
| -rw-r--r-- | src/buffer.hh | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/buffer.hh b/src/buffer.hh index 2b27f7c3..50423502 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -66,7 +66,7 @@ public: BufferIterator() = default; BufferIterator(const Buffer& buffer, BufferCoord coord) noexcept; - BufferIterator(ArrayView<const StringDataPtr> lines, BufferCoord coord) noexcept; + BufferIterator(const StringDataPtr* lines, LineCount line_count, BufferCoord coord) noexcept; bool operator== (const BufferIterator& iterator) const noexcept; auto operator<=>(const BufferIterator& iterator) const noexcept; @@ -76,7 +76,7 @@ public: const char& operator[](size_t n) const noexcept; size_t operator- (const BufferIterator& iterator) const; - explicit operator bool() const { return not m_lines.empty(); } + explicit operator bool() const { return m_lines; } BufferIterator operator+ (ByteCount size) const; BufferIterator operator- (ByteCount size) const; @@ -95,9 +95,10 @@ public: using Sentinel = BufferCoord; private: - ArrayView<const StringDataPtr> m_lines; + const StringDataPtr* m_lines; + [[no_unique_address]] StringView m_line; + [[no_unique_address]] LineCount m_line_count; BufferCoord m_coord; - StringView m_line; }; using BufferLines = Vector<StringDataPtr, MemoryDomain::BufferContent>; |
