Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 697
mirk Avatar asked Apr 30 '13 16:04

mirk


1 Answers

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)>;
like image 200
Pubby Avatar answered Oct 03 '22 09:10

Pubby