turning an array of structs into a struct of arrays

Vlad Levenfeld via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 6 10:35:21 PDT 2015


On Sunday, 5 July 2015 at 00:07:59 UTC, Laeeth Isharc wrote:
> Posted short write-up here.  Please make it better...
>
> http://wiki.dlang.org/Transforming_slice_of_structs_into_struct_of_slices


In John Colvin's solution, should

     alias TransformMembers(alias TypeTransform, alias 
NameTransform, T) = Tuple!(
         RoundRobin!(Pack!(staticMap!(TypeTransform, 
FieldTypeTuple!PriceBar)),
                     Pack!(staticMap!(NameTransform, 
FieldNameTuple!PriceBar))));

read

     alias TransformMembers(alias TypeTransform, alias 
NameTransform, T) = Tuple!(
         RoundRobin!(Pack!(staticMap!(TypeTransform, 
FieldTypeTuple!T)),
                     Pack!(staticMap!(NameTransform, 
FieldNameTuple!T))));

???


More information about the Digitalmars-d-learn mailing list