You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overloads `operator|` for rvalue and lvalue `Pipeable`s and downcasts
accordingly.
Adds rvalue-reference qualified overloads to FnPartial `operator|`
that calls `std::move(stored_arg)` when creating the actual iterable
object.
This allows a move-only callable to get passed by value, but only moves,
all the way into the itertool.
```
// both should work
iter::some_itertool(sequence, MoveOnlyCallable{});
sequence | iter::some_itertool(MoveOnlyCallable{});
```
I did attempt passing a `std::reference_wrapper` from the `FnPartial`
but the iteration happens after the `FnPartial` is destroyed, So the
following is unsafe:
```
// unsafe, wrong
template <typename Container>
auto operator()(Container&& container) const {
if constexpr (std::is_copy_constructible_v<T>) {
return F{}(stored_arg, std::forward<Container>(container));
} else {
return F{}(std::ref(stored_arg), std::forward<Container>(container));
}
}
```
Setting the stage to fix#89
0 commit comments