When creating an instance of a variable of the template class type using only standard type arguments, the syntax is as follows:
template<typename Arg = int> class Templ; Templ<>& myTempl;
Leaving an empty argument list <> should give a compilation error, because a list of template arguments is needed.
But apparently (at least under VS2013), the following declaration does not need a list of template arguments:
template<typename Arg> //" = int" left out class Templ{ Templ& myTempl; //no <> here };
But why does this work? According to IntelliSense, the selected type ( Templ<int> ) is selected by the compiler, so it works as intended, but should not declare the member to use an empty argument list?
EDITOR: No, it is not working properly. I did not check it carefully enough. When you hover over the line Templ<short>::myTempl IntelliSense shows that its type is short .
source share