diff --git a/lib/coveo/enumerable/enumerable.h b/lib/coveo/enumerable/enumerable.h index 3ecbf05..5e7c46e 100644 --- a/lib/coveo/enumerable/enumerable.h +++ b/lib/coveo/enumerable/enumerable.h @@ -32,10 +32,6 @@ class enumerable typedef typename detail::seq_element_traits::pointer pointer; // Pointer to a sequence element. typedef typename detail::seq_element_traits::reference reference; // Reference to a sequence element. - typedef typename detail::seq_element_traits::const_value_type const_value_type; // Const version of /value_type/. - typedef typename detail::seq_element_traits::const_pointer const_pointer; // Const version of /pointer/. - typedef typename detail::seq_element_traits::const_reference const_reference; // Const version of /reference/. - // Delegate that returns next element in sequence, or nullptr when done. // Receives a stable unique_ptr each time that can be used to store next value. typedef std::function&)> next_delegate; @@ -43,9 +39,8 @@ class enumerable // Delegate that returns number of elements in sequence. typedef std::function size_delegate; - // Forward declaration of iterator classes. + // Forward declaration of iterator class. class iterator; - class const_iterator; private: next_delegate zero_; // Next delegate which we will clone to iterate sequence. @@ -110,16 +105,9 @@ class enumerable iterator begin() const { return iterator(*this, false); } - const_iterator cbegin() const { - return const_iterator(*this, false); - } - iterator end() const { return iterator(*this, true); } - const_iterator cend() const { - return const_iterator(*this, true); - } // Access to size of sequence bool has_fast_size() const { @@ -272,57 +260,6 @@ class enumerable } }; - // Iterator for the elements in an enumerable's sequence, but returning const references. - class const_iterator - { - public: - // Standard iterator typedefs, plus a few more - typedef std::forward_iterator_tag iterator_category; - typedef typename enumerable::const_value_type value_type; - typedef typename enumerable::raw_value_type raw_value_type; // Non-standard - typedef std::ptrdiff_t difference_type; - typedef typename enumerable::const_pointer pointer; - typedef typename enumerable::const_reference reference; - - private: - iterator it_; // Iterator implementation we're simply wrapping. - - public: - // Default constructor - const_iterator() = default; - - // Constructor from enumerable - const_iterator(const enumerable& parent, bool is_end) - : it_(parent, is_end) { } - - // Element access - reference operator*() const { - return *it_; - } - pointer operator->() const { - return it_.operator->(); - } - - // Move to next element (pre/post versions) - const_iterator& operator++() { - ++it_; - return *this; - } - const_iterator operator++(int) { - const_iterator it(*this); - ++*this; - return it; - } - - // Iterator comparison - friend bool operator==(const const_iterator& left, const const_iterator& right) { - return left.it_ == right.it_; - } - friend bool operator!=(const const_iterator& left, const const_iterator& right) { - return !(left == right); - } - }; - public: // Helper static methods diff --git a/tests/coveo/enumerable/enumerable_tests.cpp b/tests/coveo/enumerable/enumerable_tests.cpp index 6eb4127..2674349 100644 --- a/tests/coveo/enumerable/enumerable_tests.cpp +++ b/tests/coveo/enumerable/enumerable_tests.cpp @@ -23,12 +23,6 @@ void validate_sequence(const coveo::enumerable& seq, const C& expected, bool COVEO_ASSERT(obj == *eit++); } COVEO_ASSERT(eit == eend); - eit = std::begin(expected); - for (auto sit = seq.cbegin(), send = seq.cend(); sit != send; ++sit) { - COVEO_ASSERT(eit != eend); - COVEO_ASSERT(*sit == *eit++); - } - COVEO_ASSERT(eit == eend); COVEO_ASSERT(seq.has_fast_size() == fast_size); COVEO_ASSERT(seq.size() == expected.size()); }