[Cs3] default template type arguments

Mikhail Nesterenko mikhail at cs.kent.edu
Wed Sep 16 23:46:44 EDT 2015


CS3 students,

as it turns out, default template type arguments are allowed. In
general, default arguments are allowed for templated classes but not
for templated standalone functions (for historical reasons). That is, 
constructs like this are legal:

  template <typename T=int, int Size=100>
  class Stack {
  ....

At instantiation, the type and non-type parameters, but not angle
brackets, may be skipped:

  Stack<>  myStack; // default arguments are used.


Thanks,
-- 
Mikhail


More information about the cs3 mailing list