You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I *think* it should be possible to combine `walk*_vectors_or_scalars` together with some complicated fold instructions, lambdas, tuples, and std::apply.
The current implementation of walk*_vectors_or_scalars introduced in #1976 manually implements each path separately. This is due to the difficulty of combining the separate vector paths in a single unified implementation. However, there is a common structure shared among all three functors and @danhoeflinger's recommendation looks implementable.
When exploring combining the implementations, we should consider readability / complexity of the fold instruction approach when determining if we should adopt it. Additionally, the walk1_vector_or_scalar implementation should avoid explicit copying (as currently implemented), so the user's unary functor in std::for_each can still directly modify the reference.
The text was updated successfully, but these errors were encountered:
Take a look at the first answer of https://stackoverflow.com/questions/7230621/how-can-i-iterate-over-a-packed-variadic-template-argument-list. I think you should do something similar, chaining together instructions by returning tuples and then with
std::apply
.Here is an example I was playing with.
https://godbolt.org/z/vc8dK4ed6
In the end, I'm not sure if (1) its actually possible and (2) its worth the complexity to consolidate these structs, but its worth considering...
Originally posted by @danhoeflinger in #1976 (comment)
The current implementation of
walk*_vectors_or_scalars
introduced in #1976 manually implements each path separately. This is due to the difficulty of combining the separate vector paths in a single unified implementation. However, there is a common structure shared among all three functors and @danhoeflinger's recommendation looks implementable.When exploring combining the implementations, we should consider readability / complexity of the fold instruction approach when determining if we should adopt it. Additionally, the
walk1_vector_or_scalar
implementation should avoid explicit copying (as currently implemented), so the user's unary functor instd::for_each
can still directly modify the reference.The text was updated successfully, but these errors were encountered: