Tuple deconstruction in Phobos
Nick Treleaven
nick at geany.org
Sun Jul 21 10:51:24 UTC 2024
On Sunday, 21 July 2024 at 04:05:52 UTC, IchorDev wrote:
> On Saturday, 20 July 2024 at 20:48:29 UTC, Nick Treleaven wrote:
>> Instead of the `tie` assignment, you can just do:
>> ```d
>> import std.meta;
>> AliasSeq!(y, x) = tupRetFn().expand;
>> ```
>
> And here I was trying to use comma expressions for this like a
> buffoon! Of course they didn't work, but I'm pleasantly
> surprised that using a sequence does.
I think The lvalue sequence docs in template.dd were only updated
in the last year to mention sequence assignment.
> I should really PR `std.typecons` to add a couple of examples
> of this, because I think a lot of people will have overlooked
> it.
Good idea.
More information about the Digitalmars-d-learn
mailing list