diff options
author | Noel Grandin <noel@peralex.com> | 2015-04-28 15:01:43 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-04-29 10:41:40 +0200 |
commit | 6bb742b9cbbdabbbd53dd9cdf6cb165e4b30bf86 (patch) | |
tree | e483f00c38dd38429e307a170f80d95dddf57d0e /include/o3tl | |
parent | a9bfa6547ae2a4721363289f3816568e6a7e6a2d (diff) |
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
Diffstat (limited to 'include/o3tl')
-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 |