From 6bb742b9cbbdabbbd53dd9cdf6cb165e4b30bf86 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 28 Apr 2015 15:01:43 +0200 Subject: convert STR_EVENT constants to scoped enum - also add needed infrastructure to o3tl::enumarray so we can use std::find on it - move the Impl inside the .cxx file, no need to expose it in the header Change-Id: I7758a6175849f46723d97b1e657f846524c3b7cd --- include/o3tl/enumarray.hxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/o3tl') 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 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 -- cgit