diff options
| author | babenko <[email protected]> | 2024-12-14 10:23:55 +0300 |
|---|---|---|
| committer | babenko <[email protected]> | 2024-12-14 10:37:43 +0300 |
| commit | c3657504c642129865fc8cfdeacb98ef2da8d830 (patch) | |
| tree | cead21bc291ff91957fe949cba63843d21fa9f9d /library | |
| parent | 499c02cc41e48d4edb91558305ab6fc8c4df8de0 (diff) | |
Introduce (any use) YT_STATIC_INITIALIZER
commit_hash:7d3055f901a21e63f7860f443252a86e9895fd08
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 |
