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 T
vsrequires
for type checking -
void T
is preferred overrequires
for performance -
void T
is a way to normalize types and can help with type checking -
There is a performance difference between using
void T
and not using it - The performance difference is significant and noticeable
-
To measure performance, use the
--time-trace
flag in Clang -
full-expression
is a concept that is useful in metaprogramming -
constexpr
is used to create compile-time values -
STATIC_ASSERT
is used to check if a value is true at compile-time -
index_sequence
is a type that can be used to iterate over a list of types -
void T
can be used to create a recursive alias template -
orderable
is a concept that is used to check if a type is orderable -
std::tuple
can be used to create a tuple of types -
std::pair
can be used to create a pair of types -
SFINAE
is a technique used to enable or disable function overloads based on the type of arguments -
std::sort
can be used to sort a list of types -
ENABLE_IF
is a template function that can be used to enable or disable a function based on the type of arguments -
typeid
can be used to get the type of an object at runtime -
type_identity
is a template that can be used to create a type identity -
template metaprogramming
is a technique used to create code that manipulates types at compile-time -
C++20
introduces new features that make it easier to usevoid T
-
Clang
has a feature called--time-trace
that can be used to measure the time it takes to compile code