std.array: array, ulong and Win32

Timon Gehr via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 9 13:39:07 PDT 2015


On 08/09/2015 10:13 PM, ixid wrote:
> This seems like a reasonable use but errors, obviously I can do it in
> many other ways:
>
>      ulong[] result = iota(1UL, 10UL).array;
>
>
> Error: static assert  "Argument types in (ulong) are not all convertible
> to size_t: (ulong)"    C:\D\dmd2\src\phobos\std\array.d    516
> ...

I consider this to be a bug. Also, it's annoying static assert abuse.

> And while I'm here why do arrays not implicitly cast?

Array literals do cast implicitly.

> ulong is happy to accept uint values but ulong[] will not accept uint[].

Many reasons. E.g. it would be a hidden not-necessarily-constant-time 
operation.


More information about the Digitalmars-d-learn mailing list