import std.stdio;
import automem;
import std.experimental.allocator.mallocator : Mallocator;

interface IGetInt
{
    @nogc int GetInt();
}

class Foo : IGetInt
{
    @nogc int GetInt()
    {
        return 42;
    }
}

@nogc void main()
{
    auto foo = Unique!(Foo, Mallocator).construct;

    printf("Value is %d!\n", foo.GetInt());

// Unique!(IGetInt, Mallocator) ifoo = Unique!(Foo, Mallocator).construct;
//     printf("Value is %d!\n", ifoo.GetInt());
}

How to cast from a class to an interface in such situation? Is it possible?

And one more question: Where can i find actual status(or plans) of @nogc support for Phobos and language constructs?

Reply via email to