Synax for variadic template

Alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 1 03:27:13 PDT 2017


On Friday, 1 September 2017 at 10:01:16 UTC, Nicholas Wilson 
wrote:
>
> b.arr refers to an `(AliasSeq!(int, double))[]`, so with 
> `b.arr[0] ~= 5;` you are trying to append a integer to an array 
> of pairs of ints and doubles, which you can't do.
>
> b.arr[0] ~= ElementType!(typeof(b.arr))(5,42.0);
>
> should work (I hope, not tested) but you cannot append only the 
> int.
>
> If you are trying to abstract the array for struct of array vs. 
> array of struct the take a look at 
> https://maikklein.github.io/post/soa-d/

Ok... I think I need some type of soa, yes.
But in the article, there is too much of effort done, to convert 
types to arrays, at least at the stage of my code... At the end, 
if I compare the amount of code in the article and just "[]" 
more, as for the part of my example that works...

Thanks for the cool link, nevertheless... Cool to see, how it 
should be done :)


More information about the Digitalmars-d-learn mailing list