40 #include <QtCore/qglobal.h>
42 #ifndef QGLOBALSTATIC_H
43 #define QGLOBALSTATIC_H
45 #include <QtCore/qatomic.h>
48 #include <type_traits>
62 using Type =
typename QGS::QGS_Type;
80 std::atomic_thread_fence(std::memory_order_acquire);
114 "The global static was used after being destroyed");
120 "The global static was used after being destroyed");
127 static Holder holder;
128 return holder.pointer();
136 #define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
138 QT_WARNING_DISABLE_CLANG("-Wunevaluated-expression") \
139 namespace { struct Q_QGS_ ## NAME { \
140 typedef TYPE QGS_Type; \
141 static void innerFunction(void *pointer) \
142 noexcept(noexcept(std::remove_cv_t<QGS_Type> ARGS)) \
144 new (pointer) QGS_Type ARGS; \
147 static QGlobalStatic<QtGlobalStatic::Holder<Q_QGS_ ## NAME>> NAME; \
151 #define Q_GLOBAL_STATIC(TYPE, NAME, ...) \
152 Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, (__VA_ARGS__))
void storeRelaxed(T newValue) noexcept
auto it unsigned count const
#define Q_DISABLE_COPY_MOVE(Class)
#define Q_ASSERT_X(cond, x, msg)
static QtGlobalStatic::GuardValues guardValue() noexcept
bool exists() const noexcept
static Type * instance() noexcept(Holder::ConstructionIsNoexcept)
bool isDestroyed() const noexcept
static constexpr bool ConstructionIsNoexcept
Holder() noexcept(ConstructionIsNoexcept)
PlainType * pointer() noexcept
std::remove_cv_t< Type > PlainType
static QBasicAtomicInteger< qint8 > guard