21 template<
typename ArrayExtents>
24 static_assert(!std::is_const_v<ArrayExtents>);
58 for(
auto i =
static_cast<int>(
rank) - 2; i >= 0; i--)
60 if(current[i + 1] != extents[i + 1])
80 for(
auto i =
static_cast<int>(
rank) - 2; i >= 0; i--)
85 current[i + 1] = extents[i] - 1;
110 for(
auto i =
static_cast<int>(
rank) - 1; i > 0 && n != 0; i--)
122 assert(current[i] < extents[i]);
128 (current[0] < extents[0]
129 || (current[0] == extents[0]
130 && std::all_of(std::begin(current) + 1, std::end(current), [](
auto c) {
return c == 0; })))
131 &&
"Iterator was moved past the end");
166 assert(a.extents == b.extents);
170 for(
auto i =
static_cast<int>(
rank) - 2; i >= 0; i--)
172 n += (a.current[i] - b.current[i]) * size;
173 size *= a.extents[i];
184 assert(a.extents == b.extents);
185 return a.current == b.current;
199 assert(a.extents == b.extents);
202 auto first1 = std::begin(a.current);
203 auto last1 = std::end(a.current);
204 auto first2 = std::begin(b.current);
205 auto last2 = std::end(b.current);
206 for(; (first1 != last1) && (first2 != last2); ++first1, (void) ++first2)
208 if(*first1 < *first2)
210 if(*first2 < *first1)
214 return (first1 == last1) && (first2 != last2);
216 return std::lexicographical_compare(
217 std::begin(a.current),
219 std::begin(b.current),
220 std::end(b.current));
249 template<
typename ArrayExtents>
253 , std::ranges::view_base
256 static_assert(!std::is_const_v<ArrayExtents>);
275 endPos[0] = this->
toArray()[0];
276 return {*
this, endPos};
#define LLAMA_FN_HOST_ACC_INLINE
constexpr auto toArray() const -> Index
static constexpr std::size_t rank
ArrayIndex< T, rank > Index
Iterator supporting ArrayIndexRange.
constexpr auto operator-=(difference_type n) noexcept -> ArrayIndexIterator &
constexpr friend auto operator+(ArrayIndexIterator it, difference_type n) noexcept -> ArrayIndexIterator
constexpr auto operator*() const noexcept -> value_type
constexpr auto operator--(int) noexcept -> ArrayIndexIterator
constexpr friend auto operator<(const ArrayIndexIterator &a, const ArrayIndexIterator &b) noexcept -> bool
constexpr friend auto operator>(const ArrayIndexIterator &a, const ArrayIndexIterator &b) noexcept -> bool
constexpr friend auto operator==(const ArrayIndexIterator< ArrayExtents > &a, const ArrayIndexIterator< ArrayExtents > &b) noexcept -> bool
static constexpr std::size_t rank
constexpr friend auto operator!=(const ArrayIndexIterator< ArrayExtents > &a, const ArrayIndexIterator< ArrayExtents > &b) noexcept -> bool
constexpr friend auto operator+(difference_type n, ArrayIndexIterator it) noexcept -> ArrayIndexIterator
constexpr auto operator++(int) noexcept -> ArrayIndexIterator
typename ArrayExtents::Index value_type
constexpr auto operator+=(difference_type n) noexcept -> ArrayIndexIterator &
constexpr auto operator[](difference_type i) const noexcept -> reference
constexpr friend auto operator-(ArrayIndexIterator it, difference_type n) noexcept -> ArrayIndexIterator
constexpr friend auto operator>=(const ArrayIndexIterator &a, const ArrayIndexIterator &b) noexcept -> bool
constexpr friend auto operator-(const ArrayIndexIterator &a, const ArrayIndexIterator &b) noexcept -> difference_type
constexpr auto operator++() noexcept -> ArrayIndexIterator &
std::random_access_iterator_tag iterator_category
constexpr auto operator--() noexcept -> ArrayIndexIterator &
constexpr ArrayIndexIterator() noexcept=default
constexpr friend auto operator<=(const ArrayIndexIterator &a, const ArrayIndexIterator &b) noexcept -> bool
constexpr auto operator->() const noexcept -> pointer
std::ptrdiff_t difference_type
Range allowing to iterate over all indices in an ArrayExtents.
constexpr auto end() const noexcept -> ArrayIndexIterator< ArrayExtents >
constexpr auto begin() const noexcept -> ArrayIndexIterator< ArrayExtents >
constexpr ArrayIndexRange() noexcept=default