aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/misc/static_initializer.h
blob: ebaa35a1a24c545ab7e73294546a8455a8eb56d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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