On May 21, 2010, at 12:44 PM, John Dlugosz
wrote:
The problem is, I can't easily name the base class here in the base
initialization list. I'm not even sure repeating the if_
metaexpression here would work, since the init list doesn't even
like typedefs but wants the literal name of the class.
Especially when my base class is a template with a number of
parameters, I often do write something like:
class Subclass: BaseClass
{
typedef BaseClass super;
public:
Subclass(whatever):
super(whatever),
...
{}
...
};
Also, this lets an override method forward a call to the base-class
method by writing super::method();
I have lots of code that does this, built using various versions of
gcc and MSVC. While I admit it's suboptimal to have to restate the
base-class type expression, doing it as the first item in the body
helps me remember to keep them in sync.
What part isn't working for you?