BufferIterator are Random Access iterators
This commit is contained in:
parent
d2df6a9f15
commit
07c8379313
|
@ -31,7 +31,7 @@ public:
|
|||
typedef size_t difference_type;
|
||||
typedef const value_type* pointer;
|
||||
typedef const value_type& reference;
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
|
||||
BufferIterator() : m_buffer(nullptr) {}
|
||||
BufferIterator(const Buffer& buffer, BufferCoord coord);
|
||||
|
@ -44,6 +44,7 @@ public:
|
|||
bool operator>= (const BufferIterator& iterator) const;
|
||||
|
||||
char operator* () const;
|
||||
char operator[](size_t n) const;
|
||||
size_t operator- (const BufferIterator& iterator) const;
|
||||
|
||||
BufferIterator operator+ (ByteCount size) const;
|
||||
|
|
|
@ -62,6 +62,11 @@ inline char BufferIterator::operator*() const
|
|||
return m_buffer->at(m_coord);
|
||||
}
|
||||
|
||||
inline char BufferIterator::operator[](size_t n) const
|
||||
{
|
||||
return m_buffer->at(m_buffer->advance(m_coord, n));
|
||||
}
|
||||
|
||||
inline size_t BufferIterator::operator-(const BufferIterator& iterator) const
|
||||
{
|
||||
kak_assert(m_buffer == iterator.m_buffer);
|
||||
|
|
Loading…
Reference in New Issue
Block a user