On Thursday, 12 May 2016 at 14:20:28 UTC, H. S. Teoh wrote:
Does alias this solve the problem, or it introduces new ones?

void foo ( ref char[] x )
{
    static assert (x.sizeof == Wrapper.sizeof);
    (cast(Wrapper*) &x).someMethod(); // may resize x
}

Not sure how alias this can be applicable here. One recurring reason to write code like this is when one replaces plain type with more type-safe wrapper but wants to keep old API working with raw arrays as deprecated.

Reply via email to