mirk
mirk

Reputation: 5510

forward declare a template alias

I have an aliased template, defined with the using directive:

template<typename A>
using T=TC<decltype(A::b),decltype(A::c)>;

Does C++11 offer a mechanism to forward declare this template alias T?

I tried:

template<typename> struct T;

and:

template<typename>
using T;

but both return compiler errors ("conflict with previous declaration"). I am using gcc 4.8.

What is the syntax to get this to work?

Upvotes: 10

Views: 3328

Answers (1)

Pubby
Pubby

Reputation: 53047

No, it's not possible.

What you want to do is forward declare TC, then define T immediately below it.

template<typename T, typename U>
struct TC;

template<typename A>
using T=TC<decltype(A::b),decltype(A::c)>;

Upvotes: 14

Related Questions