Destructured Tuple Assignment
John Colvin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 15 03:47:55 PDT 2015
On Friday, 15 May 2015 at 10:23:24 UTC, Per Nordlöw wrote:
> I recall having seen an example of using some D magic (via
> mixin perhaps?) to realize tuple destructuring in assignments
> like
>
> magic(first, _, second) = expression.findSplit(separator);
>
> somewhere. But I can't seem to find it right now.
>
> References anyone?
>
> BTW :I'm aware of Kenjis PR, which I am very much longing for ;)
Well there's always this, which is a bit ugly:
typeof(expression) first, _, second;
TypeTuple!(first, _, second) = expression.findSplit(separator);
But of course the holy grail is being able to declare variables
inline.
More information about the Digitalmars-d-learn
mailing list