N4051: Allow typename in a template template parameter -- Richard Smith

A new WG21 paper is available. A copy is linked below, and will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4051

Date: 2014-05-26

Allow typename in a template template parameter

by Richard Smith


Since the introduction of alias templates, C++ has had type templates that are not class templates, and in particular now has template template arguments that are not class templates. However, the syntax for template template parameters still requires the class keyword be used:

template<typename T> struct A {};
template<typename T> using B = int;

template<template<typename> class X> struct C;
C<A> ca; // ok
C<B> cb; // ok, not a class template
template<template<typename> typename X> struct D; // error, cannot use typename here

... This difference is artificial and is a common surprise. Removing it would make the language simpler.


Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.