Johan Fjeldtvedt:

https://gist.github.com/Jaffe-/6983847

I think something like that should go in Phobos. But I'd like some improvements:
- Perhaps you can use a syntax similar to the tuples one:
ParallelStaticArray!(int,"field1", string,"field2", double,"field3", 5) test1; auto test2 = ParallelDynArray!(int,"field1", string,"field2", double,"field3")(5); A version is meant to have fixed size and the other is more like a dynamic array. - I think it's useful to have a syntax to "group" fields, so they are represented as parallel arrays of smaller structs instead of just parallel arrays. This is useful if you have to read/write fields in a coherent way. - I think this data structure should have a basic capability to analyse its usage patterns (this feature is off on default and can be switched on with a template argument). This is useful to tune the grouping of fields. - Iteration is a bit tricky. Probably it's a good idea to iterate only on one group at a time.

Bye,
bearophile

Reply via email to