Tuple deconstruction in Phobos
Nick Treleaven
nick at geany.org
Sat Jul 20 20:48:29 UTC 2024
On Saturday, 20 July 2024 at 14:02:21 UTC, IchorDev wrote:
> Why does Phobos not provide a method to easily deconstruct
> tuples? Here's a trivial implementation:
...
> tie!(y, x) = tupRetFn().expand;
> writeln(x,", ",y);
> }
> ```
> Not having this is like if Phobos didn't have `AliasSeq`. Yes
> you can make your own, but it's wasteful boilerplate.
Instead of the `tie` assignment, you can just do:
```d
import std.meta;
AliasSeq!(y, x) = tupRetFn().expand;
```
More information about the Digitalmars-d-learn
mailing list