Simultaneously assigning to all values in a tuple

Simen Kjærås simen.kjaras at gmail.com
Mon Apr 1 10:12:50 UTC 2019


On Monday, 1 April 2019 at 09:46:34 UTC, Jacob Carlborg wrote:
> 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);

Since the question was how to assign to all values in a tuple:"

t.expand = Repeat!(2, 1.0);

--
   Simen


More information about the Digitalmars-d-learn mailing list