Template Metaprogramming: Type Traits (part 1 of 2) - Jody Hagins - CppCon 2020

preview_player
Показать описание

---
Template metaprogramming is a vast subject, but there are a small number of basic fundamental idioms that are used over and over. Mastery of these idioms will help in reading, writing, and using modern C++ code. The type traits that come as part of the standard library are incredibly useful, but at times can be thought of as some form of dark magic.

In this tutorial, we will explore some of the fundamental idioms of template metaprogramming by implementing a good portion of the type traits from the standard library. In so doing, attendees will come away with a solid understanding of how to apply the fundamental template metaprogramming idioms to solve problems including, but not limited to, standard type traits.

---
Jody Hagins first compiled "C++" code in 1984, and wrote a specialized LisP editor using Zortech C++ for senior project in 1988. However, he didn't truly start programming in C++ until 1992, when he read The Greatest C++ Book Ever Written, "Advanced C++ Programming Styles and Idioms" by Jim Coplien. That book, combined with cfront, which generated C code from C++ source, gave him the joyful task of writing SVr4 Streams drivers in C++. Ever since, he has been hooked on writing C++ code for kernel modules, large telephony applications, and, since the late 1990s, applications in what is now known as the high frequency trading industry.

---

*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

This should be the MUST WATCH tutorial for template metaprogramming. Very helpful to get the overview.

DalasYoo
Автор

Good talk. C++ is cool. Lots of cool functionalities and yet the basics are advanced and everything is looking like witchery

motbus
Автор

Extremely helpful. Very well prepared slides with colors and boxes. Hope you could prepare some more general templates programming videos.

perfumedsea
Автор

long overdue in learning type traits. Thanks a lot for this intro.😄

letsbegin_staytrue
Автор

CppCon 2014: Walter E. Brown "Modern Template Metaprogramming: A Compendium"

andraantariksa
Автор

Really cool stuff. I wish I had that talk years ago.

ecosta
Автор

What I like about constexpr is that essentially, we can have a constexpr function return values of different types, thus making it kind of a meta function, right? Used it just last week, where inside the function, I have a "if constexpr(...) {} else {}" where the two different branches return different types, thanks to the auto keyword in the function signature.

simonfarre
Автор

How do you deal with increased compile times as a result of template usage?

origamibulldoser
Автор

This is nowhere near as introductory as I would have hoped. A lot of the examples need to be explained way way more . Like the integral_constant at 27:27. Using integral_constant within the definition of integral_constant just gets glossed over. Unbelievable!

Jacob
Автор

Great intro to type manipulation using templates

dekadebashish
Автор

13:31 Why on Earth do you have IntIdentity<42>::value, when your static member is called my_value ????

Jacob
Автор

So I went and watched Dr. Brown video and now I am facing the delimma, do I need to watch this one?

childhood
Автор

A good example for adding specializations is

eLBehmo
Автор

I've been programming with assembler and turbo pascal since 87 and been using c++ since 98, and since template metaprogramming was first introduced until now, I've been avoiding it successfully. so disliked it. MFC is not helping either by making things so easy in the conventional class programming.
Now I have to learn it since I'm using Boost, and watching these series is really helpful

child_of_god_
Автор

Holy moly at 40:53 ... he tried SO HARD to explain true_type to the chat, and I really feel like the wording of that explanation was WAY more confusing than it should have been... "It's true that it's true if the true_type is true" 😵

klt
Автор

Am I missing something? I can not use the "auto " in the templates

IshakHeor
Автор

I should've just stick with template "<typename T> class ClassName { ...};"

comradepeter
Автор

After watching the whole video, I still don't get it.

yupeng