Why can't structs be derived from?

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Mar 15 15:34:50 PDT 2011


Speaking of structs, shouldn't it be possible to write this:?

struct AAWrapper(KeyType, ValType)
{
    ValType[][KeyType] payload;
    alias payload.opIndex opIndex;
}

The reasoning behind this is that opIndex in AAWrapper really just
forwards to payload's opIndex, while other functions like
opIndexAssign would be specialized in AAWrapper. This currently does
not compile though.


More information about the Digitalmars-d mailing list