More like :

import std.stdio;

interface IStuff(Stuff)
{
     void foo();
}

class TypeClass(T, I) : I(T)
{
     alias this stuff;
     T stuff;
}

void myAwesomeAlgo(Stuff) (TypeClass!(Stuff, IStuff) stuff)
{
     stuff.foo();
}

struct MyStuff
{
    void foo()
    {
        writeln("Hello World !");
    }
}

void main()
{
    alias TypeStuff = TypeClass!(MyStuff, IStuff);
    TypeStuff stuff;
    myAwesomeAlgo(stuff);
}

Doesn't compile btw :

kmeans.d(8): Error: members expected
kmeans.d(8): Error: { } expected following aggregate declaration
kmeans.d(8): Error: Declaration expected, not '('
kmeans.d(12): Error: unrecognized declaration

Reply via email to