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

Does __make_integer_seq intrinsic make it possible to implement meta::take in O(1)? #39

Open
ericniebler opened this issue Jun 30, 2016 · 3 comments

Comments

@ericniebler
Copy link
Owner

No description provided.

@gabyx
Copy link

gabyx commented Jun 30, 2016

what does meta::take do? is it already implemented?

(take the n-th element?)

@ericniebler
Copy link
Owner Author

See take from the Haskell Prelude for a description. Meta already has drop, but I haven't found a way to implement take in O(1) so I haven't provided it.

@ldionne
Copy link

ldionne commented Oct 31, 2017

You can prepare the pack of indices you want to take in O(1) (using __make_integer_seq, and then expand into a list using the __type_pack_element intrinsic explained in a blog post). That's technically O(K) for K elements taken because you have multiple calls to __type_pack_element, but may still be fast since it's an intrinsic. I've also worked on another intrinsic to basically take a subsequence of a parameter pack, but never submitted it for review in Clang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants