sync.atomic.init ≡
class init_once §source
Holds a boolean state which is initially set to false
and flipped to true by the first call to check
method.
template <auto Width> inline pair<bool, uint<Width>> init_generational(bool reset) §source
Amortize the cost of initializing a set of variables by assigning a generation ID to each variable. A variable is considered uninitialized if the associated generation ID does not match the current generation ID. Per-variable generation IDs only need to be initialized when the current generation ID overflows.
The returned pair first field is true if
the generation ID has overflowed and an explicit initialization to a
generation ID of 0 is required.
The returned pair second field is the
generation ID to compare against.
reset must be true on the first call to this
function.
Parameters
-
auto WidthNumber of bits in a generation ID. Higher values result in fewer initializations.