Lack of `outer` keyword makes inner class dup implossible
Jarrett Billingsley
kb3ctd2 at yahoo.com
Fri Jul 14 14:06:35 PDT 2006
"S." <S._member at pathlink.com> wrote in message
news:e98u9d$oqh$1 at digitaldaemon.com...
> It seems that because inner classes lack an `outer` keyword it is
> impossible for
> them to create a new instance for the purpose of COW when operators like
> opCom
> are called...
It's irritating, isn't it? The workaround is to make the ctor for the inner
class take a reference to its owning outer class, then you can use the
syntax
Inner dup()
{
Inner n = outerThis.new Inner(outerThis);
return n;
}
That is, you can 'new' the inner class using the outerThis reference.
I suppose another way would be to do some terribly ugly, nonportable hacks
to _find_ the outer pointer manually. Maybe if we do that, Walter will see
that having an 'outer' reference would be useful.
More information about the Digitalmars-d
mailing list