Archive for October, 2023

C++20: “constinit” Specifier

Written by on October 15, 2023 in C++, Programming with 0 Comments
C++20: “constinit” Specifier

The constinit specifier, introduced in C++20, is applied to static variables (global and local static) and thread local variables, with the requirement that they either have a zero initialization or they are initialized with a compile-time constant expression. Here is our first example: Line 17 declares a global constinit variable, initialized with a constant value. […]

Continue Reading