This works:

import std.stdio;

struct X {
private:
        bool _x;

public:
        this(bool x) {
                _x = x;
        }

        @property
        bool Get() inout {
                return this._x;
        }

        alias Get this;

        typeof(this) opAssign(bool x) {
                this._x = x;

                return this;
        }
}

void main()
{
        X a = false;
        writeln(a);
        a = true;
        writeln(a);
}

Reply via email to