As I understand, template aliases in C++0x will allow us to do the following:
template
using Dictionary = std::map< std::string, T >;
D
The syntax is:
template <typename Iter>
using ValueType = typename std::iterator_traits<Iter>::value_type;
as with your second one.
Source: http://www2.research.att.com/~bs/C++0xFAQ.html#template-alias
Their example is:
template<int N>
using int_exact = typename int_exact_traits<N>::type; // define alias for convenient notation
typename
is required when a member type follows the ::
operator and a template-id precedes it.
The usage of typename
you mention isn't specific to template aliases nor is it required unless you're aliasing to a member such as ::type
, but that is a common use case.
For example, there's no typename
when introducing a simple alias name to an existing template.
template< typename x >
class bar;
template< typename x >
using foo = bar< x >; // no typename needed