How to detect if an array if dynamic or static

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 25 11:28:59 PST 2016


On 02/25/2016 04:47 AM, sigod wrote:

 >      void bar(ref int[] arr)
 >
 > Code wouldn't compile if you try to pass static array as `ref` argument.

To qualify further, static arrays cannot be passed as slice references 
because although there is an automatic slicing of static arrays, such 
slices are rvalues and rvalues cannot be bound to 'ref' parameters:

 >      Error: function f436.bar (ref int[] arr) is not callable using
 > argument types (int[3])

Ali



More information about the Digitalmars-d-learn mailing list