From Jason Turner
Watch on YouTube

Summary

This episode explores C++17's new constexpr lambda support and its practical impact on compile-time programming. Jason demonstrates how this feature, along with constexpr std::array and constexpr algorithms, significantly simplifies code that does compile-time computation. Using his CppCon 2016 example of sorting Commodore 64 colors at compile time, he contrasts the C++14 solution (requiring custom implementations, template parameters, and workarounds) with the much cleaner C++17 approach. The C++17 version eliminates boilerplate, makes the code more readable, and removes the need for complex template parameter passing by allowing lambdas in constexpr contexts.

Resources

Tags