diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-11-01 21:51:10 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-11-01 21:51:10 +1100 |
| commit | 6fce8050ee29c97a96ff97823698d539b7c734d0 (patch) | |
| tree | 3dbf730427b761f02336caa4d422e25c475c8188 /src/buffer.inl.hh | |
| parent | 8a751e1b57b07ff43739e69f395ee4dfc3431ba0 (diff) | |
Use BufferCoord sentinel type for regex matching on BufferIterators
BufferIterators are large-ish, and need to check the buffer pointer
on comparison. Checking against a coord is just a 64 bit comparison.
Diffstat (limited to 'src/buffer.inl.hh')
| -rw-r--r-- | src/buffer.inl.hh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh index e7538694..3bc6a0b0 100644 --- a/src/buffer.inl.hh +++ b/src/buffer.inl.hh @@ -136,6 +136,16 @@ inline bool BufferIterator::operator>=(const BufferIterator& iterator) const noe return (m_coord >= iterator.m_coord); } +inline bool BufferIterator::operator==(const BufferCoord& coord) const noexcept +{ + return m_coord == coord; +} + +inline bool BufferIterator::operator!=(const BufferCoord& coord) const noexcept +{ + return m_coord != coord; +} + [[gnu::always_inline]] inline const char& BufferIterator::operator*() const noexcept { |
