We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Template Metaprogramming: Practical Application - Jody Hagins - CppCon 2021
Discover the practical application of template metaprogramming in C++ with Jody Hagins, exploring concepts like `void T`, `requires`, and `full-expression`, and uncovering performance optimizations and new features in C++20.
-
Use of
void Tvsrequiresfor type checking -
void Tis preferred overrequiresfor performance -
void Tis a way to normalize types and can help with type checking -
There is a performance difference between using
void Tand not using it - The performance difference is significant and noticeable
-
To measure performance, use the
--time-traceflag in Clang -
full-expressionis a concept that is useful in metaprogramming -
constexpris used to create compile-time values -
STATIC_ASSERTis used to check if a value is true at compile-time -
index_sequenceis a type that can be used to iterate over a list of types -
void Tcan be used to create a recursive alias template -
orderableis a concept that is used to check if a type is orderable -
std::tuplecan be used to create a tuple of types -
std::paircan be used to create a pair of types -
SFINAEis a technique used to enable or disable function overloads based on the type of arguments -
std::sortcan be used to sort a list of types -
ENABLE_IFis a template function that can be used to enable or disable a function based on the type of arguments -
typeidcan be used to get the type of an object at runtime -
type_identityis a template that can be used to create a type identity -
template metaprogrammingis a technique used to create code that manipulates types at compile-time -
C++20introduces new features that make it easier to usevoid T -
Clanghas a feature called--time-tracethat can be used to measure the time it takes to compile code