From aaa6d3ab39c2eef013c10fc093b50300063ef8aa Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 14 Aug 2014 20:35:03 +0100 Subject: [PATCH] memoryview: add support for reverse iteration --- src/memoryview.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/memoryview.hh b/src/memoryview.hh index 1f9a7feb3..324263572 100644 --- a/src/memoryview.hh +++ b/src/memoryview.hh @@ -44,6 +44,10 @@ public: const T* begin() const { return m_pointer; } const T* end() const { return m_pointer+m_size; } + using reverse_iterator = std::reverse_iterator; + reverse_iterator rbegin() const { return reverse_iterator(m_pointer+m_size); } + reverse_iterator rend() const { return reverse_iterator(m_pointer); } + const T& front() const { return *m_pointer; } const T& back() const { return *(m_pointer + m_size - 1); }