February 15th, 2011, 08:36 PM
templates, typedefs and inheritance
I find templates and inheritance confusing, something about qualified/unqualified lookups. Mostly I manage, but here is something that's troubling me:
I have base classes that depend on template parameters, and that contain convenient typedef's that may or may not also depend on the template parameters. When I inherit from the base classes, the typedefs are generally _not_ visible. Since I don't want to type e.g.
(or worse) for every "mytypedef", I make a new typedef
typedef BaseClass<typename1, typename2>::mytypedef mytypedef;
in the derived class. Obviously this works, but it feels a bit dirty. The problem now is that I'm starting to use Doxygen and Doxygen dutifully reports all the different typedefs, which looks ugly. With variables I can do e.g.
using BaseClass<typename1, typename2>::myvar
in the derived class. Can you do something similar with typedef's instead of declaring new ones all the time?
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!