[SAoC] data structures

monkyyy crazymonkyyy at gmail.com
Sat Sep 12 18:37:30 UTC 2020


So, what I'm worried about is making member indexed arrays in 
such a way that is standards complaint.

I have written a (semi-) functional aosoa, but my abstractions 
there where very much mine, and heavy template abuse *to the 
point it only worked on one compiler*.


```
struct cow{
   vec2 pos;
   vec2 vel;
   int milk;
   void update(){
     pos+=vel;
     milk++;
}}
memberindexedarray!(cow,pos) cows;
cows[0..100].map!update;
```

Making that work while deconstruction the cow into pieces is 
possible the abstraction I used in aosoa was "pointy" or roughly
```
struct pointy!cow{
   vec2* pos;
   partialcow* partialcow_;
   ... etc
}
```

with allot of really jank code that I was told repeatably was 
ugly.

While this is simpler then what I had, its still the same sort of 
problem and I expect to be playing with the edges of the 
compilers definition where the bugs are.

context:
https://www.youtube.com/watch?v=YGTZr6bmNmk - a lecture of what 
aosoa is, *in human*
https://www.dataorienteddesign.com/dodbook/node7.html#SECTION00720000000000000000 - the chapter of the "dod book" of the idea for this came form
https://github.com/crazymonkyyy/monkeydata - my aosoa lib
https://github.com/crazymonkyyy/datastuctureplayground/blob/master/planning/definetely%20doing/indexedarray.md -my current thoughts on member indexed arrays



More information about the Digitalmars-d mailing list