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

Early abortion in for_each possible? #70

Closed
gabyx opened this issue Feb 1, 2019 · 1 comment
Closed

Early abortion in for_each possible? #70

gabyx opened this issue Feb 1, 2019 · 1 comment

Comments

@gabyx
Copy link

gabyx commented Feb 1, 2019

Is there any way to support early abortion in meta::for_each (or the like).

So basically to do something at runtime for a specific Trait we can do:

int index = 2;
using A = meta::list<TraitA, TraitB , TraitC>;
meta::for_each(A{}, [](auto a){
     using Trait = decltype(a); 
     if (meta::find_index<A, Trait>  == index)
    {
          // do something ...
          return false; // abort iteration, not possible right now
    }
     return true; // true for continuation,  not possible right now
});

So far since its a aggregate initialization under the hood, this will not be possible.
Is there a better way of doing the above? With something else?

@gabyx gabyx changed the title Early abortion in for_each ... Early abortion in for_each possible? Feb 1, 2019
@gabyx
Copy link
Author

gabyx commented Feb 2, 2019

closed in favor of #57

@gabyx gabyx closed this as completed Feb 2, 2019
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