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 67cd4d8 commit b8047a5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions single_include/flux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3377,12 +3377,22 @@ struct for_each_while_fn {
if constexpr (requires { traits_t<Seq>::for_each_while(seq, std::move(pred)); }) {
return traits_t<Seq>::for_each_while(seq, std::move(pred));
} else {
auto cur = first(seq);
while (!is_last(seq, cur)) {
if (!std::invoke(pred, read_at(seq, cur))) { break; }
inc(seq, cur);
if constexpr (multipass_sequence<Seq> && bounded_sequence<Seq>) {
auto cur = first(seq);
auto end = last(seq);
while (cur != end) {
if (!std::invoke(pred, read_at(seq, cur))) { break; }
inc(seq, cur);
}
return cur;
} else {
auto cur = first(seq);
while (!is_last(seq, cur)) {
if (!std::invoke(pred, read_at(seq, cur))) { break; }
inc(seq, cur);
}
return cur;
}
return cur;
}
}
};
Expand Down

0 comments on commit b8047a5

Please sign in to comment.