shuffle a character array
celavek via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 20 02:19:25 PDT 2016
On Wednesday, 20 July 2016 at 08:30:37 UTC, Mike Parker wrote:
>
> representation does not allocate any new memory. It points to
> the same memory, same data. If we think of D arrays as
> something like this:
>
> struct Array(T) {
> size_t len;
> T* ptr;
> }
>
> Then representation is doing this:
>
> Array original;
> Array representation(original.len, original.ptr);
>
> So, yes, the char data will still be shuffled in place. All
> you're doing is getting a ubyte view onto it so that it can be
> treated as a range.
Thank you for the very useful information. I really appreciate
taking the time to explain
these, maybe trivial, things to me.
I confirmed the behavior with a test. working as expected.
More information about the Digitalmars-d-learn
mailing list