http://d.puremagic.com/issues/show_bug.cgi?id=5467



--- Comment #1 from Trass3r <mrmoc...@gmx.de> 2011-01-20 08:51:08 PST ---
And that's the latest code draft I could find:

enum Type
{
    Independent,
    Super,
    Sub,
    Parallel,
}

struct Typedef( T, Type type = Type.Sub, T init = T.init, string _f = __FILE__,
int _l = __LINE__ )
{
    T payload = init;


    static if ( type != Type.Independent )
    {
        this( T value )
        {
            payload = value;
        }
    }
    static if ( type == Type.Sub)
    {
        // typedef int foo; foo f;
        // f.opCast!(t)() == cast(t) f
        T opCast(T)()
        {
            return payload;
        }
    }
    static if ( type == Type.Sub || type == Type.Parallel )
    {
        alias payload this;
    }
    static if ( type == Type.Super )
    {
        typeof( this ) opAssign( T value )
        {
            payload = value;
            return this;
        }
    }
    else static if ( type == Type.Sub )
    {
        @disable void opAssign( T value );
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to