turning an array of structs into a struct of arrays

John Colvin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 6 15:13:03 PDT 2015


On Monday, 6 July 2015 at 17:35:22 UTC, Vlad Levenfeld wrote:
> 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))));
>
> ???

Yikes, yes, of course!


More information about the Digitalmars-d-learn mailing list