-
Notifications
You must be signed in to change notification settings - Fork 73
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
request: tuple_slice #29
Comments
A simpler implementation:
|
Related SO questions with similar implementations |
Is this supposed to return a "view" into the original tuple, instead of a copy? |
Yes, I think a view is appropriate. |
If we return to this one, while we're at it, a view makes sense, but in this case I'd prefer if the function has |
Agreed, I was thinking along the same lines recently. |
I am manipulating function arguments in boost.histogram, which I pass around as
std::tuple
. I found that I need atuple_slice
function, something which strips off some elements from a tuple of values from the front and/or back. I use this implementation:Basically, I generate an integer sequence of indices of the elements that should remain in the slice and then use a parameter pack expansion of
std::get
s.Usage:
I think this is a useful addition to Mp11. The implementation is not trivial and it seems like a common tuple manipulation.
The text was updated successfully, but these errors were encountered: