Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion source/templates.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6826,7 +6826,7 @@
A trailing template parameter pack\iref{temp.variadic} not otherwise deduced will be
deduced as an empty sequence of template arguments.
\end{note}
If all of the template arguments can be deduced, they may all be omitted;
If all of the template arguments can be deduced or obtained from default template arguments, they may all be omitted;
in this case, the empty template argument list \tcode{<>}
itself may also be omitted.
\begin{example}
Expand All @@ -6845,6 +6845,18 @@
\end{codeblock}
\end{example}

\begin{example}
\begin{codeblock}
template <typename T = int> void func(T = T{}) { }
int main()
{
func(); // calls the specialization \tcode{func<int>}
auto a = func<>; // \tcode{a} has type \tcode{void (*)(int)}
auto b = func; // OK: \tcode{b} has type \tcode{void (*)(int)}
}
\end{codeblock}
\end{example}

\pnum
\begin{note}
An empty template argument list can be used to indicate that a given
Expand Down