From 669d2e456f12c289fa6555d2cf608db1319c8b7e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 2 Oct 2012 14:09:06 +0200 Subject: [PATCH] add postfix operator++ to BufferIterator --- src/buffer.hh | 3 +++ src/buffer_iterator.inl.hh | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/buffer.hh b/src/buffer.hh index 5f16c0c1..36fc2b0d 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -59,6 +59,9 @@ public: BufferIterator& operator++ (); BufferIterator& operator-- (); + BufferIterator operator++ (int); + BufferIterator operator-- (int); + void clamp(bool avoid_eol); bool is_begin() const; diff --git a/src/buffer_iterator.inl.hh b/src/buffer_iterator.inl.hh index 0f4367ef..0738263a 100644 --- a/src/buffer_iterator.inl.hh +++ b/src/buffer_iterator.inl.hh @@ -199,6 +199,20 @@ inline BufferIterator& BufferIterator::operator--() return *this; } +inline BufferIterator BufferIterator::operator++(int) +{ + BufferIterator save = *this; + ++*this; + return save; +} + +inline BufferIterator BufferIterator::operator--(int) +{ + BufferIterator save = *this; + --*this; + return save; +} + inline bool BufferIterator::is_begin() const { assert(m_buffer);