On Friday, 17 July 2015 at 12:43:33 UTC, Martin Nowak wrote:
This is how move would look like to support @safe inference.

void move(T)(ref T source, ref T target)
{
if (() @trusted { return &source == ⌖ }()) return; // Most complicated case. Destroy whatever target had in it
        // and bitblast source over it
        static if (hasElaborateDestructor!T) () @trusted {
typeid(T).destroy(&target); }();

        static if (hasElaborateAssign!T || !isAssignable!T)
() @trusted { memcpy(&target, &source, T.sizeof); }();

This looks complicated by safety, while other attributes are inferred transparently.

Reply via email to