10#ifndef XTENSOR_XMULTIINDEX_ITERATOR
11#define XTENSOR_XMULTIINDEX_ITERATOR
13#include "xstrided_view.hpp"
14#include "xtl/xsequence.hpp"
30 using difference_type = std::size_t;
31 using iterator_category = std::forward_iterator_tag;
35 template <
class B,
class E,
class C>
37 : m_begin(std::forward<B>(begin))
38 , m_end(std::forward<E>(end))
39 , m_current(std::forward<C>(
current))
46 std::size_t
i = m_begin.size();
50 if (m_current[
i] + 1u == m_end[
i])
52 m_current[
i] = m_begin[
i];
83 return m_linear_index ==
rhs.m_linear_index;
88 return !this->operator==(
rhs);
96 std::size_t m_linear_index{0};
99 template <
class S,
class B,
class E>
108 template <
class S,
class B,
class E>
109 auto multiindex_iterator_end(B&& roi_begin, E&& roi_end)
112 resize_container(current, roi_begin.size());
113 std::copy(roi_end.begin(), roi_end.end(), current.begin());
115 std::size_t linear_index = 1;
116 for (std::size_t i = 0; i < roi_begin.size(); ++i)
118 linear_index *= roi_end[i] - roi_begin[i];
121 return xmultiindex_iterator<S>(
122 std::forward<B>(roi_begin),
123 std::forward<E>(roi_end),
standard mathematical functions for xexpressions