Рет қаралды 1,477
Class templates with the ability to partially and fully specialize them are arguably what makes C++ so powerful! We cover most of what one needs to know about what class templates are, how to specialize them fully or partially as well as how it all plays its role if we want to implement type traits.
Before you watch this video I recommend you to watch these videos if you haven't already:
why use templates: • Why use templates in m...
what templates do under the hood: • Templates under the hood
how to use function templates: • How to use FUNCTION TE...
In this video we look at
Class method templates
Class templates
How they can be specialized partially and fully
And as always some easy to follow examples as well as stories about what can go wrong with template specialization
We cover a lot of ground in this video, and it is quite long as much as I tried to keep it very short. Please do not hesitate to comment and tell me what you think or what I might have missed.
📚 As always, the script to the video with all the code examples lives here: github.com/cpp...
Links
CppInsights example mentioned at 06:14 - cppinsights.io...
Class Template Argument Deduction (CTAD) link: en.cppreferenc...
Google C++ Code Style on CTAD: google.github....
Howard Hinnant on vector of booleans: isocpp.org/blo...
Herb Sutter on vector of booleans: www.gotw.ca/pub...
Type traits: en.cppreferenc...
is_integral: en.cppreferenc...
Partial template specialization: en.cppreferenc...
Join this channel to get access to perks
/ @codeforyourself