Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exists_where doesn't work after fn::transform #5

Open
willisblackburn opened this issue Jul 5, 2021 · 0 comments
Open

exists_where doesn't work after fn::transform #5

willisblackburn opened this issue Jul 5, 2021 · 0 comments

Comments

@willisblackburn
Copy link

willisblackburn commented Jul 5, 2021

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; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant