Array literals are weird.

Imperatorn johan_forsberg_86 at hotmail.com
Sat May 1 11:58:35 UTC 2021


On Saturday, 1 May 2021 at 11:32:47 UTC, Blatnik wrote:
> I love how D redesigned the terrible C/C++ arrays. And it's 
> awesome that array operations like element wise +, -, etc. are 
> built into the language - it makes me want to use arrays and 
> slices for everything. But there are still some rough edges in 
> the design.
>
> [...]

Yeah, imo this is a rather strange limitation of the language.

I would like to be able to do

```d
int[] a = [1,2,3] * [4,5,6];
```

for example, but this yields "array operation without destination 
memory not allowed" :(


More information about the Digitalmars-d mailing list