Skip to content

Commit

Permalink
Fix cartesian_product::for_each_while to pass a tuple of elements i…
Browse files Browse the repository at this point in the history
…nstead of

a tuple of cursors to the predicate.
  • Loading branch information
brycelelbach committed Jul 12, 2023
1 parent a240dcc commit 02e73b3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/flux/op/cartesian_product.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ struct sequence_traits<detail::cartesian_product_adaptor<Bases...>>
}

template <std::size_t I, typename Self, typename Function,
typename... PartialCursor>
typename... PartialElements>
static constexpr auto for_each_while_impl(Self& self,
Function&& func,
PartialCursor&&... partial_cursor)
PartialElements&&... partial_elements)
-> std::tuple<bool, detail::cartesian_product_partial_cursor_t<Self, I>>
{
// We need to iterate right to left.
Expand All @@ -268,7 +268,7 @@ struct sequence_traits<detail::cartesian_product_adaptor<Bases...>>
auto this_current = flux::for_each_while(std::get<I>(self.bases_),
[&](auto&& elem) {
keep_going = std::invoke(func,
cursor_t<Self>(FLUX_FWD(partial_cursor)..., FLUX_FWD(elem)));
element_t<Self>(FLUX_FWD(partial_elements)..., FLUX_FWD(elem)));
return keep_going;
});
return std::tuple(keep_going, std::tuple(std::move(this_current)));
Expand All @@ -278,7 +278,7 @@ struct sequence_traits<detail::cartesian_product_adaptor<Bases...>>
auto this_current = flux::for_each_while(std::get<I>(self.bases_),
[&](auto&& elem) {
std::tie(keep_going, nested_current) = for_each_while_impl<I+1>(
self, func, FLUX_FWD(partial_cursor)..., FLUX_FWD(elem));
self, func, FLUX_FWD(partial_elements)..., FLUX_FWD(elem));
return keep_going;
});
return std::tuple(keep_going,
Expand Down

0 comments on commit 02e73b3

Please sign in to comment.