Assign Range: layout = X, AlignRight;

WebFreak001 d.forum at webfreak.org
Tue May 26 13:54:16 UTC 2020


On Tuesday, 26 May 2020 at 13:36:34 UTC, Виталий Фадеев wrote:
> [...]
>
> I want this feature in D!

I think you are rather looking for tuples:

          void opAssign(Args...)(Tuple!Args args)
          {
              foreach( a; args )
              {
                  _layouts ~= a;
              }
          }

which you can currently use like

     layout = tuple(X, AlignRight);

which is probably going to be the best you can do with D right 
now. You can also make your own type like Tuple and/or a function 
like tuple if you want more type-safety



(and maybe some day in the distant future once the comma operator 
is completely removed and a DIP for tuple syntax goes through we 
might even be able to write layout = (X, AlignRight))


More information about the Digitalmars-d-learn mailing list