diff options
Diffstat (limited to 'include/o3tl/enumarray.hxx')
-rw-r--r-- | include/o3tl/enumarray.hxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/o3tl/enumarray.hxx b/include/o3tl/enumarray.hxx index 777e205b8cf5..355e674a5e77 100644 --- a/include/o3tl/enumarray.hxx +++ b/include/o3tl/enumarray.hxx @@ -70,6 +70,8 @@ public: iterator begin() { return iterator(*this, 0); } iterator end() { return iterator(*this, size()); } + V* data() { return detail_values; } + //private: V detail_values[max_index + 1]; }; @@ -83,6 +85,10 @@ public: typedef enumarray_iterator<EA> self_type; typedef typename EA::value_type value_type; typedef typename EA::key_type key_type; + typedef std::bidirectional_iterator_tag iterator_category; //should be random access, but that would require define subtraction operators on the enums + typedef typename EA::key_type difference_type; + typedef typename EA::value_type* pointer; + typedef typename EA::value_type& reference; enumarray_iterator(EA& b, size_t start_pos) : m_buf(b), m_pos(start_pos) {} @@ -90,6 +96,7 @@ public: value_type *operator->() { return &(operator*()); } self_type &operator++() { ++m_pos; return *this; } bool operator!=(const self_type& other) { return &m_buf != &other.m_buf || m_pos != other.m_pos; } + bool operator==(const self_type& other) { return &m_buf == &other.m_buf && m_pos == other.m_pos; } }; }; // namespace o3tl |