10 #ifndef slimsig_concat_iterator_h
11 #define slimsig_concat_iterator_h
13 #include <type_traits>
16 template <
typename Iterator,
typename Traits = std::iterator_traits<Iterator>>
18 typename Traits::iterator_category,
19 typename Traits::value_type,
20 typename Traits::difference_type,
21 typename Traits::pointer_type,
22 typename Traits::reference_type
29 using range = std::pair<Iterator, Iterator>;
30 using reference =
typename iterator_traits::reference_type;
31 using pointer =
typename iterator_traits::pointer_type;
34 : m_range1(std::move(first)), m_range2(std::move(second)), m_current(first.first), m_is_first(
true) {};
40 return m_current == m_current;
43 return !(*
this == other);
46 return m_current > other.m_current;
49 return !(*
this < other);
52 return (*
this == other) || (*
this < other);
55 return (*
this == other) || (*
this > other);
60 if (m_is_first && m_current == range1.second) {
61 m_current = range2.first;
73 if (!m_is_first && m_current == range2.first) {
74 m_current = prev(range1.second);
89 auto delta = m_is_first ?
offset - std::distance(m_current, range1.second) : -1;
92 m_current = m_range2.first + delta;
104 auto delta = !m_is_first ?
offset - (std::distance(m_current, range2.first)) : -1;
107 m_current = range1.second - delta;
120 return m_current.operator->();
146 template <
typename T1,
typename T2>
151 template <
typename T1,
typename T2>