Automatic static array length

Walter Bright newshound2 at digitalmars.com
Sun Dec 30 06:09:30 UTC 2018


On 12/26/2018 2:23 PM, Your Name wrote:
> Is there a way to declare a static array with an automatic length, so that it 
> doesn't have to be manually calculated?

This does not work due to the circular reference:

   int[arr.length] arr = [1,2,3];

This works:

   enum array = [1,2,3];
   int[array.length] arr = array;



More information about the Digitalmars-d mailing list