|
Boost Users : |
Subject: Re: [Boost-users] [MPL] what is my base class?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-05-21 20:41:30
On Fri, May 21, 2010 at 10:44 AM, John Dlugosz
<JDlugosz_at_[hidden]> wrote:
> I'm writing a class template, say C<T>, that has essentially different features depending on a classification of type T. So, I implemented Ca and Cb as befitting the two categories, and then make that transparent to the user by making a stub for C that inherits from either of those two, using boost::mpl::if_ to choose between them.
>
> However, the constructors have to be brought down manually. To "inherit" them, they need to be forwarded to the base class: C (...args...) : Ca (...args...) {}
>
> 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.
>
> Did I paint myself into a corner? Please help.
>
> In one case, it was not a problem to use only a default constructor and call an inherited Initialize function from the body. Â In the other case, I want to keep my reference member initializers.
It helps a lot if you have a minimized source code that demonstrates
the problem with comments of what you want done attached to your
email?
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