|
Boost : |
From: Carl Daniel (cpdaniel_at_[hidden])
Date: 2002-02-13 11:16:38
From: "George A. Heintzelman" <georgeh_at_[hidden]>
> >
> > I've wanted 'final' before, but for a reason this doesn't address: optimization. Within a 'final' class, the
compiler
> > can statically bind all virtual member function references, since it's knows that there can be no more-derived class
> > that it doesn't know about.
> >
>
> The explicit call to Derived::doF() enables the compiler to optimize
> F() calls for Derived and, as a bonus, any further derived classes of
> Derived.
That's what I ended up doing, but it was a pain. Even more of a pain was when I found that I did want to derive from
that class, and now had to move all the explicit qualifications into the new, more-derived classes.
> A language extension to mark virtual overrides as final, ie not virtual
> for any more-derived classes, would IMHO be welcome as a safer way of
> doing this. Hey! How about using the static keyword for this? :) It's
> probably the only context where static is illegal right now, we need to
> do something about that.
static, eh? Sounds like a plan....
-cd
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk