The exists_where operation takes a const Iterable& which makes it fail when used after fn::transform or other operators... I think that ones that generate seq? The issue seems to be that seq.begin is a non-const operation because seq is consumable.
I think that exists_where should work like for_each or foldl, both of which take Iterable&&. It's really just a foldl with a fixed algorithm that can return early.
First invocation works, second one doesn't:
std::vector<int> a = {1, 2, 3};
a % fn::exists_where([](auto item_a) { return item_a == 1; });
a % fn::transform([](auto item_a) { return item_a; }) % fn::exists_where([](auto item_a) { return item_a == 1; });
The
exists_whereoperation takes aconst Iterable&which makes it fail when used afterfn::transformor other operators... I think that ones that generateseq? The issue seems to be thatseq.beginis a non-const operation becauseseqis consumable.I think that
exists_whereshould work likefor_eachorfoldl, both of which takeIterable&&. It's really just afoldlwith a fixed algorithm that can return early.First invocation works, second one doesn't: