On Thursday, 4 July 2013 at 15:59:21 UTC, TommiT wrote:

struct Toy
{
    alias Wrapped = Wrap!Toy;

    @implicit Wrapped opCast(T : Wrapped)()
    {
        return Wrapped.init;
    }
}

Let me clarify that arguably silly looking syntax. The @implicit opCast operator simply means that any instance of Toy is implicitly convertible to an instance of Wrapped!Toy, exactly like any instance of type int[10] is implicitly convertible to an instance of type int[].

Reply via email to