blob: 0c8af0f2768d5444134ee0bfc430552824528563 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#pragma once
//! Defines a global variable that is initialized on its first access.
/*!
* In contrast to a usual variable with static storage duration, this one
* is not susceptible to initialization order fiasco issues.
*/
#define YT_DEFINE_GLOBAL(type, name, ...) \
inline type& name() \
{ \
static type result{__VA_ARGS__}; \
return result; \
}
|