On Tuesday, 5 February 2013 at 16:36:16 UTC, Maxim Fomin wrote:

This does not imply such situation, simply there is a problem. You can workaround by

[snip]
struct RC {
    int i;
    void postblit() { i = -5; }
    this(this) const
    {
        void delegate() dg = &postblit;
        dg();
    }
}

Great thanks. I'll try.

But why does this even code work? I would have thought const guarantee would prevent calls to non-const postblit function. I was under impression this(this) const does not work - but maybe that has changed with 2.061.

What source (lang spec, TDPL, or newsgroup) led you to this solution and for how long will it be valid? Where can I read more on it?

Thanks
Dan

Reply via email to