On Wednesday, 20 July 2016 at 08:18:55 UTC, celavek wrote:


As far as my current understanding goes the shuffle will be done in place. If I use the "representation" would that still hold, that is will I be able to use the same char[] but in the shuffled form? (of course I will test that)

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.

Reply via email to