digitalmars.D.learn - Given two AliasSeq (A and B) and template T, how to make
- Tofu Ninja (8/8) Nov 26 2016 Basically the title says it all.
- Nicholas Wilson (3/11) Nov 26 2016 AliasSeq s auto expand. so
- Nicholas Wilson (5/13) Nov 26 2016 Whoops it would help if I read your question.
- Tofu Ninja (5/9) Nov 27 2016 That didn't actually work, but I got it working with:
Basically the title says it all. alias A = AliasSeq!(...); alias B = AliasSeq!(...); static assert(A.length == B.length); template T(An, Bn){ ... } alias C = AliasSeq!(T!(A[0], B[0]) ... T!(A[n], B[n])); // how to make this :/ How do I actually make the sequence C?
Nov 26 2016
On Sunday, 27 November 2016 at 06:01:13 UTC, Tofu Ninja wrote:Basically the title says it all. alias A = AliasSeq!(...); alias B = AliasSeq!(...); static assert(A.length == B.length); template T(An, Bn){ ... } alias C = AliasSeq!(T!(A[0], B[0]) ... T!(A[n], B[n])); // how to make this :/ How do I actually make the sequence C?AliasSeq s auto expand. so alias C = AliasSeq!(A,B);
Nov 26 2016
On Sunday, 27 November 2016 at 06:01:13 UTC, Tofu Ninja wrote:Basically the title says it all. alias A = AliasSeq!(...); alias B = AliasSeq!(...); static assert(A.length == B.length); template T(An, Bn){ ... } alias C = AliasSeq!(T!(A[0], B[0]) ... T!(A[n], B[n])); // how to make this :/ How do I actually make the sequence C?Whoops it would help if I read your question. You want to use Iota in conjunction with staticMap. alias pairs(int N, alias a, alias b) = AliasSeq(a[N],b[N]); alias C = staticMap!(T,staticMap(pairs,Iota!N));
Nov 26 2016
On Sunday, 27 November 2016 at 07:38:53 UTC, Nicholas Wilson wrote:Whoops it would help if I read your question. You want to use Iota in conjunction with staticMap. alias pairs(int N, alias a, alias b) = AliasSeq(a[N],b[N]); alias C = staticMap!(T,staticMap(pairs,Iota!N));That didn't actually work, but I got it working with: alias pairs(size_t n) = T!(A[n], B[n]); alias C = staticMap!(pairs, Iota!(A.length));
Nov 27 2016