Setting a hard limit on slice size, is this possible?

Paul Backus snarwin at gmail.com
Sat Aug 7 12:08:00 UTC 2021


On Saturday, 7 August 2021 at 07:32:04 UTC, Tejas wrote:
> And if it really is correct, then it seems once again that 
> static arrays are the answer after all:
>
> ```d
> align(your_alignment) int[your_length] array;
> ```
> No need for structs \\('_')/

The main advantage of the struct is that you can heap-allocate it:

```d
auto array = new Aligned!(int[4], 16);
```


More information about the Digitalmars-d-learn mailing list