template specialization of a nested class

E

er

hello,

here's my problem:

struct A{};
struct B{};
struct T{};

struct outer{

template<typename U>
struct inner{
typedef A type;
};

//specialization inside outer's scop has compile error:
//explicit specialization in non-namespace scope ‘struct outer’|
//using gcc version 4.2.3

};

//expected unqualified-id before ‘{’ token|

template<>
outer::inner<T>{
typedef B type;
};


thanks.
 
E

er

hello,

here's my problem:

struct A{};
struct B{};
struct T{};

struct outer{

    template<typename U>
    struct inner{
        typedef A type;
    };

    //specialization inside outer's scop has compile error:
    //explicit specialization in non-namespace scope ‘struct outer’|
    //using gcc version 4.2.3

};

//expected unqualified-id before ‘{’ token|

template<>
outer::inner<T>{
  typedef B type;

};

thanks.

oh! i guess i should have template<> struct ...
 
A

Alex

#include <stdafx.h>
#include <stdio.h>
#include <cstdlib>
#include <iostream>
using namespace std;

struct A{};
struct B{};
struct T{};


struct outer{
template<typename U>
struct inner{
typedef A type;
};


//specialization inside outer's scop has compile error:
//explicit specialization in non-namespace scope ‘struct outer’|
//using gcc version 4.2.3
};


//expected unqualified-id before ‘{’ token|
template<>
struct outer::inner<char>{
typedef B type;
};

int main(int argc, char *argv[])
{

system("PAUSE");
return 0;
}


cheers!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top