Curious effect with traits, meta, and a foreach loop ... mystifies me.

Adam D Ruppe destructionator at gmail.com
Wed Sep 8 15:53:40 UTC 2021


On Tuesday, 7 September 2021 at 17:47:15 UTC, james.p.leblanc 
wrote:
> What I mean by "dig out" the needed "x" is:  if I could 
> alias/enum/
> or someother  trick be then able just to use that "x" as a 
> simple static array.

You might be able to just cast the struct to a static array of 
the same size if the types are all compatible. Like a reinterpret 
cast of the raw memory kind of idea.

struct A {
         int a;
         int b;
}

void main() {
         A a;
         int[2] as_array = cast(int[2]) a;
}


That works. But idk if it will help with your alignment issue, I 
don't know much about avx at all.

> Thanks again, Keep Warm in Upstate!

It has actually been kinda nice the last few days!

Winter coming soon though, sigh.


More information about the Digitalmars-d-learn mailing list