memoryview: add support for reverse iteration

This commit is contained in:
Maxime Coste 2014-08-14 20:35:03 +01:00
parent 2d42783dbd
commit aaa6d3ab39

View File

@ -44,6 +44,10 @@ public:
const T* begin() const { return m_pointer; } const T* begin() const { return m_pointer; }
const T* end() const { return m_pointer+m_size; } const T* end() const { return m_pointer+m_size; }
using reverse_iterator = std::reverse_iterator<const T*>;
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& front() const { return *m_pointer; }
const T& back() const { return *(m_pointer + m_size - 1); } const T& back() const { return *(m_pointer + m_size - 1); }