Why can't structs be derived from?
Jonathan M Davis
jmdavisProg at gmx.com
Tue Mar 15 16:44:39 PDT 2011
On Tuesday, March 15, 2011 15:34:50 Andrej Mitrovic wrote:
> 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.
Does the built in AA even really have an opIndex as far as the compiler is
concerned? It would have to have that exact name for that to work, I believe.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list