Thread overview
referencing nested templates
Jan 24, 2003
Richard Grant
Jan 24, 2003
Walter
Mar 16, 2003
Richard Grant
January 24, 2003
We talked about his one before. This fails due to the "typename A<T>::template", and works with "typename A<T>::" syntax.

template<class T> struct A {
template<class U> struct B {
typedef int type;
};
};

template<class T> struct C {
typedef typename A<T>::template B<int>::type type;
// Error: identifier expected
};

void main() {
C<int> c;
}

The iterator adaptor lib and lower level libs that it depends on favor nested template references. There is a directive that attempts to work around this problem, but it is *not* implemented in this lib hierarchy. Fixing this would allow unpatched compilation of iterator adaptor lib.

Richard


January 24, 2003
You can work around it for now by simply replacing ::template with ::.

"Richard Grant" <fractal@clark.net> wrote in message news:b0r6mi$tj0$1@digitaldaemon.com...
> We talked about his one before. This fails due to the "typename
A<T>::template",
> and works with "typename A<T>::" syntax.
>
> template<class T> struct A {
> template<class U> struct B {
> typedef int type;
> };
> };
>
> template<class T> struct C {
> typedef typename A<T>::template B<int>::type type;
> // Error: identifier expected
> };
>
> void main() {
> C<int> c;
> }
>
> The iterator adaptor lib and lower level libs that it depends on favor
nested
> template references. There is a directive that attempts to work around
this
> problem, but it is *not* implemented in this lib hierarchy. Fixing this
would
> allow unpatched compilation of iterator adaptor lib.
>
> Richard
>
>


March 16, 2003
In article <b0s89v$1elh$1@digitaldaemon.com>, Walter says...
>
>You can work around it for now by simply replacing ::template with ::.
>
>"Richard Grant" <fractal@clark.net> wrote in message news:b0r6mi$tj0$1@digitaldaemon.com...
>> We talked about his one before. This fails due to the "typename
>A<T>::template",
>> and works with "typename A<T>::" syntax.

Ok, member template keyword ala A::template B<> works in fine. But inheritance using this sytax fails to compile:

struct B {
template <class T> struct C { };
};

template <class T> struct A
: B::template C<T> { };
//Error: identifier or '( declarator )' expected

int main() {
A<int> a;
}

Richard