reinterpret array

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 13 10:25:27 PST 2015


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]"
  }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150113/0e09d4d0/attachment.sig>


More information about the Digitalmars-d-learn mailing list