如何unpack/destructure D 中的数组?

How to unpack/destructure an array in D?

如何unpack/destructure D 中的数组?

我有一个包含三个元素的数组 ([3,4,5]),我想通过一次赋值将其分配给三个变量 (abc)。

我如何在 D 中执行此操作?

模块 letassign.dhttps://bitbucket.org/infognition/dstuff/src 允许以下代码:

int x, y, z;
let (x,y,z) = [1,2,3];

顺便说一下,这应该在标准 D 库中!

尝试 tie from my dub package vest:

import vest.utils: tie;
int a,b,c;
tie(a,b,c) = [1, 2, 2];

tie 支持数组、范围、元组