Prev: An Algorithm Intensive Programming Contest - Manthan @ Codefest - IT-BHU
Next: const is an overrated concept that is a source of extra typing and maintenance
From: Nikolay Ivchenkov on 27 Mar 2010 06:18 Is it allowed to use default template-arguments and template parameter pack in templated alias declaration? template <class T, class... Types> struct X { typedef typename T<Types...>::type type; }; // is it legal? template <class T = void, class... Types> using A = typename X<T, Types...>::type; I don't see any special rules about this. For example, N3035 - 14.2/11 contains the following statements: "If a template-parameter of a class template has a default template- argument, each subsequent template-parameter shall either have a default template-argument supplied or be a template parameter pack. If a template-parameter of a class template is a template parameter pack, it shall be the last template-parameter." I think, the same restrictions shall be applied to template aliases (which are not class templates themselves). -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |