Static array with parameter based size?

Miguel L via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 12 23:26:17 PDT 2017


On Wednesday, 12 July 2017 at 18:49:23 UTC, Jack Applegame wrote:
> On Wednesday, 12 July 2017 at 05:45:13 UTC, Miguel L wrote:
>> Also what is it possible in D to write a function that accepts 
>> an static array of any size?
>
> void foo(size_t N)(ref int[N] arr) {
>     ...
> }
>
> int[10] arr;
> foo(arr);

Thank you very much for your answers.


More information about the Digitalmars-d-learn mailing list