diff options
| author | Maxime Coste <mawww@kakoune.org> | 2022-11-20 16:59:08 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2022-11-20 16:59:08 +1100 |
| commit | b7b036c210aba03c5dc1851b9de5fe9b3351dcd8 (patch) | |
| tree | dd86ca3e519c1c875868353afc872f0e03da2cdd /src/buffer.inl.hh | |
| parent | 91d45a100a39345f06d9789ded9172fe60887c27 (diff) | |
Change BufferIterator comparison to assert same buffer
Comparing iterators between buffers should never happen, and the
only place we did was with default constructed BufferIterator which
we replace by casting the iterator to bool.
This should improve performance on iterator heavy code.
Diffstat (limited to 'src/buffer.inl.hh')
| -rw-r--r-- | src/buffer.inl.hh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh index 4f264c0d..4f6866bf 100644 --- a/src/buffer.inl.hh +++ b/src/buffer.inl.hh @@ -104,7 +104,8 @@ inline BufferIterator::BufferIterator(const Buffer& buffer, BufferCoord coord) n inline bool BufferIterator::operator==(const BufferIterator& iterator) const noexcept { - return m_buffer == iterator.m_buffer and m_coord == iterator.m_coord; + kak_assert(m_buffer == iterator.m_buffer); + return m_coord == iterator.m_coord; } inline std::strong_ordering BufferIterator::operator<=>(const BufferIterator& iterator) const noexcept |
