From Jason Turner
Watch on YouTube

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.

Resources

Tags