餓漢模式C++

無海發表於2024-05-29
#define SINGLETON_DEFINE(ClassName)            \
static ClassName* GetInstance()                \
{                                              \
    static ClassName _instance;                \
    return &_instance;                         \
}                                              \
ClassName(const ClassName&) = delete;          \
ClassName& operator=(const ClassName&) = delete

相關文章