Re: Is there a typedef or a using-declaration equivalent for
templates ?
On 2012-03-20 09:28, Timothy Madden wrote:
On 20.03.2012 07:03, Daniel Kr?gler wrote:
From your first description I guess you mean something like
template<class>
struct A {
template<class...>
struct I {};
};
as dependent base class template and usage within B like this:
template<class T>
struct B : A<T> {
typedef A<T> super_t;
typename super_t::template I<T, int> m;
};
Is this correct?
Yes, except I just want
super_t::template I
and not
super_t::template I<T, int>
because I want to later specialize I with many different arguments.
Now I'm completely confused given your original description where you wrote:
"I end up with a rather long construct to use throughout my
class:
base_class_name:: template templ_name <arg,...>"
Can you please provide a simple and self-explaining example?
Well I do not have gcc 4.7 yet (but 4.6.1 from MinGW), but I still have
a question:
Even with an alias-declaration, how does the compiler know if the named
template is a function template or a class template ? Or is the
alias-declaration only used for class templates ?
This has nothing to to with class templates, but with types instead. An
alias declaration always declares a type or a family of types (when a
template). How could this be related to function templates, which are
families of functions?
template <class... Args>
using I = super_t::template I<Args...>;
Recall that super_t is dependent, so
super_t::template I
means just about nothing to the compiler...
Sure, it means that template I must refer to a type (family), anything
else could only be ill-formed. Should I have misunderstood what you are
trying to say, please elaborate in more detail.
HTH & Greetings from Bremen,
Daniel Kr?gler
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]