Why use templates in modern C++

Why use templates in modern C++

Code for yourself

55 лет назад

2,548 Просмотров

The first video out of a number of videos about templates. Here we focus on *why* anybody would want to use templates in the first place, leaving the details to what templates do and how to properly use them in C++ to the future videos.

If you want to know *what* templates do under the hood, see this video: https://youtu.be/NKvEbPVllRE

📚 As always, the script to the video lives here: https://github.com/cpp-for-yourself/supplementary-materials/blob/main/lectures/templates_why.md

00:00 - Intro
01:12 - Short intro to templates
02:47 - Function templates
05:33 - Class and struct templates
06:23 - Templates for abstract code design
08:26 - Side note on the strategy design pattern
09:30 - Catching bugs at compile time
10:17 - Compile-time meta-programming
11:46 - Summary

🔗 Some additional links:
- CppReference page on template parameters: https://en.cppreference.com/w/cpp/language/template_parameters
- Google C++ Code Style naming rules: https://google.github.io/styleguide/cppguide.html#General_Naming_Rules
- Chandler Carruth' talk about nothing being free: https://www.youtube.com/watch?v=rHIkrotSwcc

#MadeWithMotionCanvas
Ссылки и html тэги не поддерживаются


Комментарии: