Skip to content

Commit

Permalink
Update single header
Browse files Browse the repository at this point in the history
  • Loading branch information
tcbrindle authored and github-actions[bot] committed Mar 14, 2024
1 parent 05c555e commit bf3540b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions single_include/flux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5177,9 +5177,20 @@ struct cartesian_traits_base_impl {
static constexpr auto last(Self& self) -> cursor_t<Self>
requires cartesian_is_bounded<Bases...>
{
auto cur = first(self);
std::get<0>(cur) = flux::last(get_base<0>(self));
return cur;
if constexpr (CartesianKind == cartesian_kind::product) {
auto cur = first(self);
bool any_is_empty = std::apply([](auto& /*ignored*/, auto&... bases) {
return (flux::is_empty(bases) || ...);
}, self.bases_);
if (!any_is_empty) {
std::get<0>(cur) = flux::last(get_base<0>(self));
}
return cur;
} else {
auto cur = first(self);
std::get<0>(cur) = flux::last(get_base<0>(self));
return cur;
}
}

template <typename Self>
Expand Down

0 comments on commit bf3540b

Please sign in to comment.