static_initializer.h 566 B

12345678910111213141516171819
  1. #pragma once
  2. #include "preprocessor.h"
  3. namespace NYT {
  4. ////////////////////////////////////////////////////////////////////////////////
  5. //! Static initializer will be invoked prior to entering |main|.
  6. //! The exact order of these invocations is, of course, undefined.
  7. #define YT_STATIC_INITIALIZER(...) \
  8. [[maybe_unused]] static inline const void* PP_ANONYMOUS_VARIABLE(StaticInitializer) = [] { \
  9. __VA_ARGS__; \
  10. return nullptr; \
  11. } ()
  12. ////////////////////////////////////////////////////////////////////////////////
  13. } // namespace NYT