Structure of Arrays vs Array of Structures

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 14 23:44:53 PDT 2017


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?


More information about the Digitalmars-d-learn mailing list