Is there a decomposition for tuples and other data structures?
For example,
auto t = tuple(1, "2");
auto (x, y) = t; // or auto (x, y) = t.expand;
Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 13, 2021 Structured binding declaration (like in C++) | ||||
---|---|---|---|---|
| ||||
Is there a decomposition for tuples and other data structures? For example,
|
October 14, 2021 Re: Structured binding declaration (like in C++) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vindex | On 10/13/21 1:02 PM, Vindex wrote:
> Is there a decomposition for tuples and other data structures?
>
> For example,
> ```
> auto t = tuple(1, "2");
> auto (x, y) = t; // or auto (x, y) = t.expand;
> ```
No, D does not have this (yet?).
I thought there was a special case for tuples with foreach but I can't remember it now. (?)
Ali
|
October 14, 2021 Re: Structured binding declaration (like in C++) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vindex | On Wednesday, 13 October 2021 at 20:02:05 UTC, Vindex wrote: >Is there a decomposition for tuples and other data structures? No, but you can emulate it, e.g. by using AliasSeq:
|
October 14, 2021 Re: Structured binding declaration (like in C++) | ||||
---|---|---|---|---|
| ||||
Posted in reply to MoonlightSentinel | On Thursday, 14 October 2021 at 15:29:13 UTC, MoonlightSentinel wrote: >On Wednesday, 13 October 2021 at 20:02:05 UTC, Vindex wrote: >Is there a decomposition for tuples and other data structures? No, but you can emulate it, e.g. by using AliasSeq:
Thank you! This is a good variant of decision of the problem |