reinterpret array
Dominikus Dittes Scherkl via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jan 13 12:00:56 PST 2015
On Tuesday, 13 January 2015 at 18:25:38 UTC, ketmar via
Digitalmars-d-learn wrote:
> On Tue, 13 Jan 2015 17:09:31 +0000
> Dominikus Dittes Scherkl via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com> wrote:
>
>> /// interpret an array of one type as an array of a
>> different type.
> may i point you to this?
>
> import std.stdio;
>
> void main () {
> ubyte[] a = [42,0,0,0, 155,2,0,0];
> auto b = cast(uint[])a;
> writeln(b); // "[42, 667]"
> }
I see. So this function is completely superfluous :-/
Good to know.
So if I have a function that allowes to do this:
uint a;
a.bit[16] = true;
writeln(a); // 65536
Is it also already available?
Because I somewhat hate it that with D I can create great stuff,
but it is not necessary because D already has something much
cooler...
More information about the Digitalmars-d-learn
mailing list