
On Fri, May 21, 2010 at 10:44 AM, John Dlugosz
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?