Some array casts
Douglas Peterson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jan 21 12:04:17 PST 2015
On Wednesday, 21 January 2015 at 18:08:44 UTC, bearophile wrote:
>> The sizeof values aren't relevant for D array casts. What
>> matters are the array "contents".
>
> See:
>
> void main() {
> int[5] m = cast(int[5])[1, 2, 3, 4, 5];
> assert(m == [1, 2, 3, 4, 5]);
> pragma(msg, m.sizeof); // 20u
> pragma(msg, [1, 2, 3, 4, 5].sizeof); // 8u
> }
>
>
> Bye,
> bearophile
i'm sorry if I've lead you on a wrong way.
My bad.
More information about the Digitalmars-d-learn
mailing list