Converting (casting?) a dynamic array to a fixed array?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 4 11:12:07 PDT 2015


On 05/04/2015 08:36 AM, WhatMeWorry wrote:

 > But just for arguments sake, wouldn't it have
 > been better to define in dynamic array properties a .sizeofref and a
 > .sizeof (which behaves like the static array.sizeof)?

It would not work because

1) .sizeof means the size of the variable that a piece of code is 
dealing with, regardless of the size of data that it may own or manage.

2) It is and must be a compile-time property used in templates.

Ali



More information about the Digitalmars-d-learn mailing list