Skip to content

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

Description

@willisblackburn

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; });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions