How do you pass in a static array by reference?

Jakob Ovrum via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 7 22:01:24 PST 2016


On Monday, 8 February 2016 at 05:59:43 UTC, Enjoys Math wrote:
>
>
> I have several class members:
>
> Arc[4] arcs;
> Arc[4] arcs_2;
>
> and Id like to initialize them with the same function, so how 
> do I "pass them in" by reference?

void foo(ref Arc[4] arr)
{
     …
}

The dimension can of course be templatized:

void foo(size_t n)(ref Arc[n] arr)
{
     …
}


More information about the Digitalmars-d-learn mailing list