February 09, 2024 Learn » Re: How to unpack a tuple into multiple variables? | |||
|---|---|---|---|
| |||
Thank you Menjanahary R.! I've saved the code to review and learn from! :> | |||
February 08, 2024 Learn » Re: How to unpack a tuple into multiple variables? | |||
|---|---|---|---|
| |||
...std.stdio : writefln;
import std.typecons: tuple;
// Name a Tuple's fields post hoc by... | |||
February 07, 2024 Learn » Re: How to unpack a tuple into multiple variables? | |||
|---|---|---|---|
| |||
On Wednesday, 7 February 2024 at 13:18:00 UTC, ryuukk_ wrote: I just wanted... | |||
February 07, 2024 Learn » Re: How to unpack a tuple into multiple variables? | |||
|---|---|---|---|
| |||
There was a DIP for native tuples in D, hopefully we'll get it soon | |||
February 07, 2024 Learn » Re: How to unpack a tuple into multiple variables? | |||
|---|---|---|---|
| |||
On Wednesday, 7 February 2024 at 01:17:33 UTC, zjh wrote: Wouldn't that... | |||
February 07, 2024 Learn » Re: How to unpack a tuple into multiple variables? | |||
|---|---|---|---|
| |||
...that takes a tuple and field names. It returns a new tuple with those field... | |||
February 07, 2024 Learn » Re: How to unpack a tuple into multiple variables? | |||
|---|---|---|---|
| |||
Officially, there should be an unpacking solution, like ```d //C++ auto[a,b,c]=tuple. ``` | |||
February 06, 2024 Learn » Re: How to unpack a tuple into multiple variables? | |||
|---|---|---|---|
| |||
...provided:
```d
auto getUser() => tuple("John Doe", 32);
// Name a Tuple's fields post hoc... | |||
February 06, 2024 Learn » Re: How to unpack a tuple into multiple variables? | |||
|---|---|---|---|
| |||
...import std.typecons : tuple;
void main() {
// Create a tuple
auto myTuple = tuple(10, "hello", [1... | |||
February 06, 2024 Learn » Re: How to unpack a tuple into multiple variables? | |||
|---|---|---|---|
| |||
Thank you Sergey! Still reading through the different 'solutions' - very informative. | |||
Copyright © 1999-2021 by the D Language Foundation