Registration is now open for CppCon 2021, which starts on October 24 and will be held both in person and online. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from our most recent in-person conference in 2019 and our online conference in 2020. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2021 to attend in person, online, or both!
Reducing Template Compilation Overhead, Using C++11, 14, 17, and 20
by Jorg Brown
Summary of the talk:
At their best, new C++ standards offer simpler, clearer, and faster-to-compile ways to write your code. But many information sources, for example Andrei Alexandrescu’s Modern C++ Design, haven’t been updated.
More importantly, template metaprogramming is not something we generally seek to optimize because a good compiler handles it well, and problems generally only show up in the form of long compile times.
In this presentation, I'll describe techniques you can use to simplify, clarify, and improve the compile speed, of your code, including:
* Using C++17 "if constexpr"
* Using C++11 variadic function / template arguments (often without needing recursion!)
* Using decltype on auto-return functions in order to compute types in a more readable way.
* Using C++20 constraints rather than std::enable_if
Add a Comment
Comments are closed.