Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPL] what is my base class?
From: Nat Goodspeed (nat_at_[hidden])
Date: 2010-05-22 10:46:09


On May 21, 2010, at 12:44 PM, John Dlugosz <JDlugosz_at_[hidden]>
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<etc.>
{
     typedef BaseClass<etc.> 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?
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net