Re: Dependent type in template base class
In article <eo5dnd$a4j$1@news01.versatel.de>, Stephan Tolksdorf
<andorxor@gmx.de> wrote:
Hi,
I'd like to make the name of a member type in a template base class
directly available to the child class. (I don't want to qualify each
reference to the type with "typename Base<T>::" in order to avoid
extremely ugly code).
I'm currently doing this with an using declaration as in the following
code snippet:
template <typename T>
class base {
struct param_type { };
void f(param_type& p) { }
};
template <typename T>
class test : base<T> {
using typename base<T>::param_type;
test(param_type& p) { } // GCC doesn't recognize param_type
}
is
template <class T>
class test:public base<T> // is private inheritance really wanted??
{
typedef typename base<T>::param_type param_type;
test(param_type &p);
};
any better??
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]