Skip to content

Commit

Permalink
simplify op<
Browse files Browse the repository at this point in the history
  • Loading branch information
alfC committed Dec 24, 2024
1 parent 3e504d4 commit cfb935c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions include/boost/multi/array_ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,12 @@ struct array_iterator // NOLINT(fuchsia-multiple-inheritance)
// }

BOOST_MULTI_HD constexpr auto operator< (array_iterator const& other) const -> bool {
assert((*ptr_).layout() == (*(other.ptr_)).layout());
assert(stride_ != 0);
return
((0 < stride_) && (ptr_.base() - other.ptr_.base() < 0))
|| ((stride_ < 0) && (0 < ptr_.base() - other.ptr_.base())); // TODO(correaa) consider the case where stride_ is negative
// assert((*ptr_).layout() == (*(other.ptr_)).layout());
// assert(stride_ != 0);
// return
// ((0 < stride_) && (ptr_.base() - other.ptr_.base() < 0))
// || ((stride_ < 0) && (0 < ptr_.base() - other.ptr_.base())); // TODO(correaa) consider the case where stride_ is negative
return 0 < other - *this;
}

BOOST_MULTI_HD constexpr explicit array_iterator(typename subarray<element, D-1, element_ptr>::element_ptr base, layout_t<D-1> const& lyt, index stride)
Expand Down

0 comments on commit cfb935c

Please sign in to comment.