On 12/03/2015 05:14 PM, Jonathan M Davis wrote:
You declare static functions on a struct or class and then make the
struct or class unusable as an object (e.g. by having a final abstract
class or explicitly disabling all ways to construct the struct or class).

I must be dense. Consider:

struct List
{
    int x;
    template _stable()
    {
        void fun()
        {
             import std.stdio;
             writeln(this.x);
        }
    }
    alias stable = _stable!();
}

void main()
{
    List lst;
    lst.stable.fun();
}

Could you please redo the example with a struct?


Thanks,

Andrei

Reply via email to