Skip to content

Latest commit

 

History

History
417 lines (250 loc) · 18.5 KB

templates.md

File metadata and controls

417 lines (250 loc) · 18.5 KB

Templates

Table of contents


Introduction and overview

🔗

🎥

📄

📖

Applications

🎥


Template arguments

🔗

Argument deduction

🎥

Class template argument deduction (CTAD)

🔗

🎥

Deduction guides


Concepts

See also Concepts – The standard library and proposals.

🔗

🎥

Standard concepts

Applications

🔗


Function templates

🔗

🎥

Friend function templates

🎥


Parsing and compilation

🔗

Optimization

🔗

🎥

extern template

Two-phase lookup

Names are resolved in two steps: first, non-dependent names are resolved at the time of template definition and, second, dependent names are resolved at the time of template instantiation.

🔗

Keywords template and typename as disambiguators

struct S { template<typename T> using type = T; };
template<class T> void foo() { typename T::template type<int> x; }

foo<S>();

🔗

🎥


SFINAE

"Substitution Failure Is Not An Error" – when substituting the explicitly specified or deduced type for the template parameter fails, the specialization is discarded from the overload set instead of causing a compile error.

🔗

Detection idiom


Specialization

🔗


Explicit instantiation


Tuples

🔗

🎥


Type lists

🔗

📖


Type traits

See also Type traits – The standard library and Boost.

🔗

🎥


Variadic templates

🔗

🎥

Fold expressions

🔗