[temp.decls.general]

# 13 Templates [[temp]](./#temp)

## 13.7 Template declarations [[temp.decls]](temp.decls#general)

### 13.7.1 General [temp.decls.general]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L2592)

The template parameters of a template are specified in
the angle bracket enclosed list
that immediately follows the keyword template[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L2597)

A [*primary template*](#def:template,primary "13.7.1 General [temp.decls.general]") declaration is one
in which the name of the template is not followed by
a [*template-argument-list*](temp.names#nt:template-argument-list "13.3 Names of template specializations [temp.names]")[.](#2.sentence-1)

The template argument list of a primary template is
the template argument list of its [*template-head*](temp.pre#nt:template-head "13.1 Preamble [temp.pre]") ([[temp.arg]](temp.arg "13.4 Template arguments"))[.](#2.sentence-2)

A template declaration in which the name of the template is followed by
a [*template-argument-list*](temp.names#nt:template-argument-list "13.3 Names of template specializations [temp.names]") is
a partial specialization ([[temp.spec.partial]](temp.spec.partial "13.7.6 Partial specialization")) of
the template named in the declaration,
which shall be a class or variable template[.](#2.sentence-3)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L2609)

For purposes of name lookup and instantiation,
default arguments,[*type-constraint*](temp.param#nt:type-constraint "13.2 Template parameters [temp.param]")*s*,[*requires-clause*](temp.pre#nt:requires-clause "13.1 Preamble [temp.pre]")*s* ([[temp.pre]](temp.pre "13.1 Preamble")),
and[*noexcept-specifier*](except.spec#nt:noexcept-specifier "14.5 Exception specifications [except.spec]")*s* of function templates
and
of member functions of class templates
are considered definitions;
each
default argument,[*type-constraint*](temp.param#nt:type-constraint "13.2 Template parameters [temp.param]"),[*requires-clause*](temp.pre#nt:requires-clause "13.1 Preamble [temp.pre]"),
or[*noexcept-specifier*](except.spec#nt:noexcept-specifier "14.5 Exception specifications [except.spec]") is a separate definition
which is unrelated
to the templated function definition or
to any other
default arguments,[*type-constraint*](temp.param#nt:type-constraint "13.2 Template parameters [temp.param]")*s*,[*requires-clause*](temp.pre#nt:requires-clause "13.1 Preamble [temp.pre]")*s*,
or[*noexcept-specifier*](except.spec#nt:noexcept-specifier "14.5 Exception specifications [except.spec]")*s*[.](#3.sentence-1)

For the purpose of instantiation, the substatements of a[constexpr if](stmt.if#def:constexpr_if "8.5.2 The if statement [stmt.if]") statement are considered definitions[.](#3.sentence-2)

For the purpose of name lookup and instantiation,
the [*compound-statement*](stmt.block#nt:compound-statement "8.4 Compound statement or block [stmt.block]") of an [*expansion-statement*](stmt.expand#nt:expansion-statement "8.7 Expansion statements [stmt.expand]") is considered a template definition[.](#3.sentence-3)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L2641)

Because an [*alias-declaration*](dcl.pre#nt:alias-declaration "9.1 Preamble [dcl.pre]") cannot declare a[*template-id*](temp.names#nt:template-id "13.3 Names of template specializations [temp.names]"), it is not possible to partially or
explicitly specialize an alias template[.](#4.sentence-1)
