Summary
This episode examines C++17's inline variables feature, which simplifies the declaration and definition of static class members. Jason demonstrates how inline variables eliminate the need for separate out-of-class definitions of non-literal static members, solving the long-standing initialization issue. He also discusses the potential runtime cost of inline statics due to thread-safe initialization, and presents an alternative zero-cost approach using string_view and constexpr functions.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[diff.cpp11.dcl.dcl]54% match