DP_S/include/Singleton.h

16 lines
516 B
C
Raw Permalink Normal View History

2025-02-20 18:25:03 +08:00
#ifndef __SINGLETON_H__RINDRO_
#define __SINGLETON_H__RINDRO_
2022-09-01 16:56:37 +08:00
//饿汉模式
2025-02-20 18:25:03 +08:00
#define RINDRO_SINGLETON_DEFINE_S(TypeName) \
static TypeName *Get() \
{ \
static TypeName type_rindro_instance; \
return &type_rindro_instance; \
} \
\
TypeName(const TypeName &) = delete; \
TypeName &operator=(const TypeName &) = delete
2022-09-01 16:56:37 +08:00
#endif // __SINGLETON_H__