c++ multiple levels of templating

Viewed 76

I'm trying to define two templated types:

template <typename T1, typename T2>
class A {};

template <typename T1, typename T2>
using BType = std::vector<typename A<T1, T2>>::iterator;

I'm receiving an error of invalid templates. I wonder what I did wrong here.

1 Answers

You need to move the position of typename,

Inside a declaration or a definition of a template, typename can be used to declare that a dependent qualified name is a type.

template <typename T1, typename T2> 
using BType = typename std::vector<A<T1, T2>>::iterator;
//            ^^^^^^^^
Related