On Friday, 21 July 2017 at 08:53:44 UTC, Atila Neves wrote:


This works fine in dmd 2.075:

struct A
{
    this(string a) {}
    this(string a) shared {}

    ~this() {}

this(this T)(this) {} // you can reflect to find out if shared
}

void main()
{
    auto nonShared = A("");
    auto shared_ = shared A("");
    auto nonSharedCopy = nonShared;
    auto sharedCopy = shared_;
}


Atila

This look interesting: this(this T)(this) {}
What is it? Postblit?

It compiles but doesn't work for me.

this(this T)(this) {writeln("postblit"); } // doesn't print anything

Arek

Reply via email to