Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Introduction to Templates | Creating First Template
C++ Templates
course content

Conteúdo do Curso

C++ Templates

C++ Templates

1. Creating First Template
2. Templates Usage
3. Class Templates
4. Template Specialization

bookIntroduction to Templates

How to turn this in a single function?

In this course, you'll learn how to use templates in various scenarios and write concise, scalable code. For example, you'll discover how to create a single function that can replace multiple ones and it is only the tip of the iceberg.

h

functions

copy
12345
int add(int a, int b) { return a + b; } float add(float a, float b) { return a + b; } std::string add(std::string a, std::string b) { return a + b; }
h

template

copy
12
template<typename T> T add(T a, T b) { return a + b; }
Are you ready to start learning templates?

Are you ready to start learning templates?

Selecione a resposta correta

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 1
some-alt