Milo Lu
Milo Lu

Reputation: 3356

How to introduce a name alias for a type in a template

template<typename T>
using Value_type<T> = typename T::value_type;

I get errors:

expected '=' before '<' token

expected type-specifier before '<' token

Upvotes: 0

Views: 50

Answers (2)

Kerrek SB
Kerrek SB

Reputation: 476930

Like this:

template <typename T>
using Value_type = typename T::value_type;

Just like in the declaration of any primary template, the name of the template itself is not punctuated with the template parameter list.

Upvotes: 4

Dimitrios Bouzas
Dimitrios Bouzas

Reputation: 42889

template<typename T>
using Value_type = typename T::value_type;

Upvotes: 2

Related Questions