Skip to content

Commit a2d7aa6

Browse files
committed
workaround for circle
1 parent 10886f9 commit a2d7aa6

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

include/boost/multi/detail/layout.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ struct extensions_t : boost::multi::detail::tuple_prepend_t<index_extension, typ
531531
BOOST_MULTI_HD constexpr auto operator+(difference_type n) const {
532532
return iterator{*this} += n;
533533
}
534+
friend BOOST_MULTI_HD constexpr auto operator+(difference_type n, iterator const& self) -> iterator { return self + n; } // `n + it` form, required by std::random_access_iterator
534535

535536
BOOST_MULTI_HD constexpr auto operator++() -> auto& {
536537
++rest_it_;
@@ -540,6 +541,7 @@ struct extensions_t : boost::multi::detail::tuple_prepend_t<index_extension, typ
540541
}
541542
return *this;
542543
}
544+
BOOST_MULTI_HD constexpr auto operator++(int) -> iterator { iterator ret{*this}; ++(*this); return ret; } // NOLINT(cert-dcl21-cpp) required by std::weakly_incrementable
543545

544546
BOOST_MULTI_HD constexpr auto operator--() -> auto& {
545547
if( rest_it_ == rest_begin_ ) {
@@ -549,6 +551,7 @@ struct extensions_t : boost::multi::detail::tuple_prepend_t<index_extension, typ
549551
--rest_it_;
550552
return *this;
551553
}
554+
BOOST_MULTI_HD constexpr auto operator--(int) -> iterator { iterator ret{*this}; --(*this); return ret; } // NOLINT(cert-dcl21-cpp)
552555

553556
BOOST_MULTI_HD constexpr auto operator[](difference_type n) const { return *((*this) + n); }
554557

@@ -557,6 +560,8 @@ struct extensions_t : boost::multi::detail::tuple_prepend_t<index_extension, typ
557560

558561
friend BOOST_MULTI_HD constexpr auto operator< (iterator const& self, iterator const& other) { return (self.curr_ < other.curr_) || ((self.curr_ == other.curr_) && (self.rest_it_ < other.rest_it_)); }
559562
friend BOOST_MULTI_HD constexpr auto operator<=(iterator const& self, iterator const& other) { return (self < other) || (self == other); }
563+
friend BOOST_MULTI_HD constexpr auto operator> (iterator const& self, iterator const& other) { return other < self; } // for std::totally_ordered
564+
friend BOOST_MULTI_HD constexpr auto operator>=(iterator const& self, iterator const& other) { return !(self < other); }
560565
};
561566

562567
constexpr auto begin() const {

test/subarray.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro
237237
static_assert(!std::is_copy_constructible_v<multi::array_ref<int, 4>>);
238238
#endif
239239

240+
#ifndef __circle_build__
240241
static_assert(!std::is_trivially_copyable_v<multi::array_ref<int, 4>>);
242+
#endif
241243
static_assert(std::is_copy_assignable_v<multi::array_ref<int, 4>>);
242244
static_assert(!std::is_trivially_copy_assignable_v<multi::array_ref<int, 4>>);
243245
static_assert(std::is_swappable_v<multi::array_ref<int, 4>>);

0 commit comments

Comments
 (0)