Structure of Arrays vs Array of Structures

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 14 23:50:04 PDT 2017


On Monday, 15 May 2017 at 06:44:53 UTC, Nordlöw wrote:
> After having watched Jonathan Blow's talk on Jai
>
> https://www.youtube.com/watch?v=TH9VCN6UkyQ&t=2880s
>
> I realized that we should add his Array-of-Structures (AoS) 
> concept to Phobos, preferrably in std.typecons.StructArrays, as 
> something like
>
> template StructArrays(Members...)
> {
>     struct StructArrays
>     {
>         // template mixin magic that creates
>
>         // a pointers elements plus accessors for each Member 
> in Members
>
>         // element type for members functions that
>         // mimic array of structures
>         struct Struct
>         {
>             Members members;
>         }
>
>         // and used here
>         Struct byStruct() // perhaps also opSlice
>         {
>              // returns call to map
>         }
>
>         size_t length;
>     }
> }
>
> Have anybody done this already?

Yes, https://maikklein.github.io/post/soa-d/


More information about the Digitalmars-d-learn mailing list