```d import std.meta; alias put = AliasSeq; auto foo() { return tuple(1, 2, 3); } int main(string[] args) { int x, y, z; put!(x, y, z) = foo(); writeln(x, y, z); return 0; } ``` My mnemonic: "put" is "tup" backwards, and undoes what tuple does.
Re: How to unpack a tuple into multiple variables?
TTK Ciar via Digitalmars-d-learn Mon, 05 Feb 2024 13:26:48 -0800
I've been using AliasSeq for that (and aliasing it to "put" for
easier use):
- How to unpack a tuple into multi... Gary Chike via Digitalmars-d-learn
- Re: How to unpack a tuple i... TTK Ciar via Digitalmars-d-learn
- Re: How to unpack a tup... Gary Chike via Digitalmars-d-learn
- Re: How to unpack a tuple i... Sergey via Digitalmars-d-learn
- Re: How to unpack a tup... Gary Chike via Digitalmars-d-learn
- Re: How to unpack a tuple i... Profunctor via Digitalmars-d-learn
- Re: How to unpack a tup... Gary Chike via Digitalmars-d-learn
- Re: How to unpack a... Menjanahary R. R. via Digitalmars-d-learn
- Re: How to unpa... Gary Chike via Digitalmars-d-learn
- Re: How to unpack a tuple i... zjh via Digitalmars-d-learn
- Re: How to unpack a tup... Gary Chike via Digitalmars-d-learn
- Re: How to unpack a... ryuukk_ via Digitalmars-d-learn