diff options
Diffstat (limited to 'library')
| -rw-r--r-- | library/cpp/yt/misc/static_initializer.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/library/cpp/yt/misc/static_initializer.h b/library/cpp/yt/misc/static_initializer.h new file mode 100644 index 00000000000..ebaa35a1a24 --- /dev/null +++ b/library/cpp/yt/misc/static_initializer.h @@ -0,0 +1,19 @@ +#pragma once + +#include "preprocessor.h" + +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// + +//! Static initializer will be invoked prior to entering |main|. +//! The exact order of these invocations is, of course, undefined. +#define YT_STATIC_INITIALIZER(...) \ + [[maybe_unused]] static inline const void* PP_ANONYMOUS_VARIABLE(StaticInitializer) = [] { \ + __VA_ARGS__; \ + return nullptr; \ + } () + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT |
