Equivalents to policy classes in D

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Apr 19 20:37:22 PDT 2012


On 4/20/12, Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> wrote:
> That said, I'm surprised that it accepts the () given that the constructor
> does
> ask for a number.

You can use:
@disable this();

But it doesn't work in all cases:

struct Foo
{
    @disable this();
    this(int i) { }
}

void main()
{
    Foo foo;  // error, OK
    auto foo = Foo();  // no error
}

I don't know if this is by design..


More information about the Digitalmars-d-learn mailing list