1 --- include/mdds/multi_type_vector_itr.hpp
2 +++ include/mdds/multi_type_vector_itr.hpp
4 typedef typename parent_type::size_type size_type;
5 typedef iterator_value_node<size_type, typename parent_type::element_block_type> node;
7 - iterator_common_base() : m_cur_node(0, 0) {}
8 + iterator_common_base() : m_cur_node(0, 0), m_singular(true) {}
11 const base_iterator_type& pos, const base_iterator_type& end,
12 size_type start_pos, size_type block_index) :
13 m_cur_node(start_pos, block_index),
23 iterator_common_base(const iterator_common_base& other) :
24 m_cur_node(other.m_cur_node),
27 + m_singular(other.m_singular)
31 + m_pos = other.m_pos;
32 + m_end = other.m_end;
39 base_iterator_type m_pos;
40 base_iterator_type m_end;
44 bool operator== (const iterator_common_base& other) const
46 iterator_common_base& operator= (const iterator_common_base& other)
48 m_cur_node = other.m_cur_node;
49 - m_pos = other.m_pos;
50 - m_end = other.m_end;
51 + m_singular = other.m_singular;
54 + m_pos = other.m_pos;
55 + m_end = other.m_end;
61 void swap(iterator_common_base& other)
63 m_cur_node.swap(other.m_cur_node);
64 - std::swap(m_pos, other.m_pos);
65 - std::swap(m_end, other.m_end);
66 + std::swap(m_singular, other.m_singular);
67 + if (!(m_singular || other.m_singular))
69 + std::swap(m_pos, other.m_pos);
70 + std::swap(m_end, other.m_end);
72 + else if (!m_singular)
74 + m_pos = other.m_pos;
75 + m_end = other.m_end;
77 + else if (!other.m_singular)
79 + other.m_pos = m_pos;
80 + other.m_end = m_end;
84 const node& get_node() const { return m_cur_node; }