ref parameter qualifier and static arrays
Paul via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Sep 9 13:18:55 PDT 2015
Is it possible to call a function like this...
void foo(ref int[] anArray)
...with slices of static arrays? I thought I might be able to use
[0..$-1] but to no avail - I get an error like this (which is
confusing!):
(ref int[] anArray) is not callable using argument types (int[])
I've modified the function declaration and used .ptr when calling
it but it seems like a retrograde step for a modern language -
although I suppose ref is pretty much the same thing.
In practice I'm using arrays of structs (which are of various
fixed sizes and known at compile time) that are currently global
in scope - something that I'd like to avoid.
I suppose I could just ask, what is the 'best' way to give access
to variously sized static arrays between different modules?
More information about the Digitalmars-d-learn
mailing list