mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 08:25:43 +08:00
Initialize function-local static variables using "T& t = *new T"
This commit is contained in:
parent
5ebfc92730
commit
d89fff6c7c
@ -12,7 +12,7 @@ namespace details {
|
||||
struct console_mutex {
|
||||
using mutex_t = std::mutex;
|
||||
static mutex_t &mutex() {
|
||||
static mutex_t s_mutex;
|
||||
static mutex_t& s_mutex = *new mutex_t;
|
||||
return s_mutex;
|
||||
}
|
||||
};
|
||||
@ -20,7 +20,7 @@ struct console_mutex {
|
||||
struct console_nullmutex {
|
||||
using mutex_t = null_mutex;
|
||||
static mutex_t &mutex() {
|
||||
static mutex_t s_mutex;
|
||||
static mutex_t& s_mutex = *new mutex_t;
|
||||
return s_mutex;
|
||||
}
|
||||
};
|
||||
|
@ -234,7 +234,7 @@ SPDLOG_INLINE void registry::set_levels(log_levels levels, level::level_enum *gl
|
||||
}
|
||||
|
||||
SPDLOG_INLINE registry ®istry::instance() {
|
||||
static registry s_instance;
|
||||
static registry& s_instance = *new registry;
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
static void clear() { get_context().clear(); }
|
||||
|
||||
static mdc_map_t &get_context() {
|
||||
static thread_local mdc_map_t context;
|
||||
static thread_local mdc_map_t& context = *new mdc_map_t;
|
||||
return context;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user