diff --git a/src/enum_set.h b/src/enum_set.h index 2a5a5c26d..8e57704b5 100644 --- a/src/enum_set.h +++ b/src/enum_set.h @@ -97,45 +97,4 @@ class enum_array_t : public std::array()> { const Elem &operator[](T t) const { return super::operator[](index_of(t)); } }; -/// A counting iterator for an enum class. -/// This enumerates the values of an enum class from 0 up to (not including) count. -/// Example: -/// for (auto v : enum_iter_t) {...} -template -class enum_iter_t { - using base_type_t = typename std::underlying_type::type; - struct iterator_t { - friend class enum_iter_t; - using iterator_category = std::forward_iterator_tag; - using value_type = T; - using difference_type = long; - - explicit iterator_t(base_type_t v) : v_(v) {} - - T operator*() const { return static_cast(v_); } - const T *operator->() const { return static_cast(v_); } - - iterator_t &operator++() { - v_ += 1; - return *this; - } - - const iterator_t operator++(int) { - auto res = *this; - v_ += 1; - return res; - } - - bool operator==(iterator_t rhs) const { return v_ == rhs.v_; } - bool operator!=(iterator_t rhs) const { return v_ != rhs.v_; } - - private: - base_type_t v_{}; - }; - - public: - iterator_t begin() const { return iterator_t{0}; } - iterator_t end() const { return iterator_t{static_cast(enum_count())}; } -}; - #endif diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index ed6c4fde7..ac7a59187 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -347,13 +347,6 @@ static void test_enum_set() { do_test((enum_set_t{test_enum::beta} | test_enum::alpha).to_raw() == 3); do_test((enum_set_t{test_enum::beta} | enum_set_t{test_enum::alpha}) .to_raw() == 3); - - unsigned idx = 0; - for (auto v : enum_iter_t{}) { - do_test(static_cast(v) == idx); - idx++; - } - do_test(static_cast(test_enum::COUNT) == idx); } static void test_enum_array() {