buffer to struct type conversion...TArrayStream?

Charles Hixson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 19 11:36:21 PDT 2015


On 03/19/2015 11:18 AM, ketmar via Digitalmars-d-learn wrote:
> On Thu, 19 Mar 2015 10:47:05 -0700, Charles Hixson via Digitalmars-d-learn
> wrote:
>
> turn it 90 degrees. ;-)
>
>    auto cvt = cast(Node_*)buf.ptr;
>    n = cvt[0];
Whee! Thanks, I don't think I *ever* would have thought of that.  I got 
as far as getting a pointer to buf, but then couldn't figure out how to 
turn the Node_* into a Node.  (Obvious now that you showed me, and I 
even think I've seen that trick done before.)


More information about the Digitalmars-d-learn mailing list