Simultaneously assigning to all values in a tuple

Jacob Carlborg doob at me.com
Mon Apr 1 09:46:34 UTC 2019


On 2019-03-28 01:29, Jamie wrote:
> Is it possible to assign to all values in a tuple at once if they are 
> the same type?
> I.e.
> 
> Tuple!(double, "x", double, "y") t;
> t[] = 1.0;
> 

Yes:

Tuple!(double, "x", double, "y") t;
t.expand = AliasSeq!(3.1, 4.2);

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list