Make BufferIterator::operator* return a const ref to be more compatible
This commit is contained in:
parent
04119d6207
commit
f8106690b1
|
@ -64,8 +64,8 @@ public:
|
||||||
bool operator> (const BufferIterator& iterator) const;
|
bool operator> (const BufferIterator& iterator) const;
|
||||||
bool operator>= (const BufferIterator& iterator) const;
|
bool operator>= (const BufferIterator& iterator) const;
|
||||||
|
|
||||||
char operator* () const;
|
const char& operator* () const;
|
||||||
char operator[](size_t n) const;
|
const char& operator[](size_t n) const;
|
||||||
size_t operator- (const BufferIterator& iterator) const;
|
size_t operator- (const BufferIterator& iterator) const;
|
||||||
|
|
||||||
BufferIterator operator+ (ByteCount size) const;
|
BufferIterator operator+ (ByteCount size) const;
|
||||||
|
@ -133,7 +133,7 @@ public:
|
||||||
|
|
||||||
String string(ByteCoord begin, ByteCoord end) const;
|
String string(ByteCoord begin, ByteCoord end) const;
|
||||||
|
|
||||||
char byte_at(ByteCoord c) const;
|
const char& byte_at(ByteCoord c) const;
|
||||||
ByteCount distance(ByteCoord begin, ByteCoord end) const;
|
ByteCount distance(ByteCoord begin, ByteCoord end) const;
|
||||||
ByteCoord advance(ByteCoord coord, ByteCount count) const;
|
ByteCoord advance(ByteCoord coord, ByteCount count) const;
|
||||||
ByteCoord next(ByteCoord coord) const;
|
ByteCoord next(ByteCoord coord) const;
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
[[gnu::always_inline]]
|
[[gnu::always_inline]]
|
||||||
inline char Buffer::byte_at(ByteCoord c) const
|
inline const char& Buffer::byte_at(ByteCoord c) const
|
||||||
{
|
{
|
||||||
kak_assert(c.line < line_count() and c.column < m_lines[c.line].length());
|
kak_assert(c.line < line_count() and c.column < m_lines[c.line].length());
|
||||||
return m_lines[c.line][c.column];
|
return m_lines[c.line][c.column];
|
||||||
|
@ -152,12 +152,12 @@ inline bool BufferIterator::operator>=(const BufferIterator& iterator) const
|
||||||
}
|
}
|
||||||
|
|
||||||
[[gnu::always_inline]]
|
[[gnu::always_inline]]
|
||||||
inline char BufferIterator::operator*() const
|
inline const char& BufferIterator::operator*() const
|
||||||
{
|
{
|
||||||
return m_buffer->byte_at(m_coord);
|
return m_buffer->byte_at(m_coord);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline char BufferIterator::operator[](size_t n) const
|
inline const char& BufferIterator::operator[](size_t n) const
|
||||||
{
|
{
|
||||||
return m_buffer->byte_at(m_buffer->advance(m_coord, n));
|
return m_buffer->byte_at(m_buffer->advance(m_coord, n));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user