diff --git a/include/sdsl/int_vector.hpp b/include/sdsl/int_vector.hpp index 940caa136..682e49be7 100644 --- a/include/sdsl/int_vector.hpp +++ b/include/sdsl/int_vector.hpp @@ -870,14 +870,6 @@ class int_vector_iterator : public int_vector_iterator_base int_vector_iterator_base(v, idx), m_word((v != nullptr) ? v->m_data + (idx>>6) : nullptr) {} - - int_vector_iterator(const int_vector_iterator& it) : - int_vector_iterator_base(it), m_word(it.m_word) - { - m_offset = it.m_offset; - m_len = it.m_len; - } - reference operator*() const { return reference(m_word, m_offset, m_len); @@ -947,16 +939,6 @@ class int_vector_iterator : public int_vector_iterator_base return *this; } - iterator& operator=(const int_vector_iterator& it) - { - if (this != &it) { - m_word = it.m_word; - m_offset = it.m_offset; - m_len = it.m_len; - } - return *this; - } - iterator operator+(difference_type i) const { iterator it = *this; @@ -1038,8 +1020,6 @@ class int_vector_const_iterator : public int_vector_iterator_base template friend typename int_vector_const_iterator::difference_type operator-(const int_vector_const_iterator& x, const int_vector_const_iterator& y); - friend class int_vector_iterator; - friend class int_vector_iterator_base; private: @@ -1054,27 +1034,20 @@ class int_vector_const_iterator : public int_vector_iterator_base int_vector_iterator_base(v, idx), m_word((v != nullptr) ? v->m_data + (idx>>6) : nullptr) {} - int_vector_const_iterator(const int_vector_const_iterator& it): - int_vector_iterator_base(it), m_word(it.m_word) - { - m_offset = it.m_offset; - m_len = it.m_len; - } - int_vector_const_iterator(const int_vector_iterator& it): - m_word(it.m_word) + int_vector_iterator_base(it), m_word(it.m_word) {} + + int_vector_const_iterator& operator=(const int_vector_iterator& it) { + m_word = it.m_word; m_offset = it.m_offset; - m_len = it.m_len; + m_len = it.m_len; + return *this; } const_reference operator*() const { - if (m_offset+m_len <= 64) { - return ((*m_word)>>m_offset)&bits::lo_set[m_len]; - } - return ((*m_word)>>m_offset) | - ((*(m_word+1) & bits::lo_set[(m_offset+m_len)&0x3F])<<(64-m_offset)); + return bits::read_int(m_word, m_offset, m_len); } //! Prefix increment of the Iterator