6 #ifndef METALL_UTILITY_CONTAINER_OF_CONTAINERS_ITERATOR_ADAPTOR_HPP
7 #define METALL_UTILITY_CONTAINER_OF_CONTAINERS_ITERATOR_ADAPTOR_HPP
19 template <
typename outer_iterator_type,
typename inner_iterator_type>
23 typename std::iterator_traits<inner_iterator_type>::difference_type;
25 typename std::iterator_traits<inner_iterator_type>::value_type;
26 using pointer =
typename std::iterator_traits<inner_iterator_type>::pointer;
28 typename std::iterator_traits<inner_iterator_type>::reference;
30 std::forward_iterator_tag;
33 outer_iterator_type outer_end)
34 : m_outer_iterator(outer_begin),
35 m_outer_end(outer_end),
38 if (m_outer_iterator != m_outer_end) {
39 m_inner_iterator = std::begin(*m_outer_iterator);
40 m_inner_end = std::end(*m_outer_iterator);
41 if (m_inner_iterator == m_inner_end) {
48 inner_iterator_type inner_iterator,
49 outer_iterator_type outer_end)
50 : m_outer_iterator(outer_begin),
51 m_outer_end(outer_end),
52 m_inner_iterator(inner_iterator),
54 if (m_outer_iterator != m_outer_end) {
55 m_inner_end = std::end(*m_outer_iterator);
56 if (m_inner_iterator == m_inner_end) {
64 return *m_inner_iterator;
78 return (m_outer_iterator == m_outer_end &&
79 other.m_outer_iterator == other.m_outer_end) ||
80 (m_outer_iterator == other.m_outer_iterator &&
81 m_inner_iterator == other.m_inner_iterator);
86 if (m_outer_iterator == m_outer_end) {
90 if (m_inner_iterator != m_inner_end) {
91 m_inner_iterator = std::next(m_inner_iterator);
92 if (m_inner_iterator != m_inner_end) {
100 std::next(m_outer_iterator);
101 if (m_outer_iterator == m_outer_end) {
106 m_inner_iterator = std::begin(*m_outer_iterator);
107 m_inner_end = std::end(*m_outer_iterator);
108 if (m_inner_iterator != m_inner_end) {
114 outer_iterator_type m_outer_iterator;
115 outer_iterator_type m_outer_end;
116 inner_iterator_type m_inner_iterator;
117 inner_iterator_type m_inner_end;
120 template <
typename outer_iterator_type,
typename inner_iterator_type>
123 inner_iterator_type> &lhs,
125 inner_iterator_type> &rhs) {
126 return lhs.equal(rhs);
129 template <
typename outer_iterator_type,
typename inner_iterator_type>
132 inner_iterator_type> &lhs,
134 inner_iterator_type> &rhs) {
135 return !(lhs == rhs);