cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
class.hpp File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CPP_TOOLBOX_DISABLE_COPY(ClassType)
 禁用类的拷贝操作 / Disable copy operations for a class
 
#define CPP_TOOLBOX_DISABLE_MOVE(ClassType)
 禁用类的移动操作 / Disable move operations for a class
 
#define CPP_TOOLBOX_DISABLE_COPY_AND_MOVE(ClassType)
 禁用类的拷贝和移动操作 / Disable both copy and move operations
 
#define CPP_TOOLBOX_DEFAULT_CONSTRUCTOR(ClassType)   ClassType() = default;
 默认构造函数宏 / Default constructor macro
 
#define CPP_TOOLBOX_DELETE_CONSTRUCTOR(ClassType)
 删除拷贝和移动构造函数 / Delete copy and move constructors
 
#define CPP_TOOLBOX_SINGLETON(ClassType)
 单例模式宏 / Singleton pattern macro
 

Macro Definition Documentation

◆ CPP_TOOLBOX_DEFAULT_CONSTRUCTOR

#define CPP_TOOLBOX_DEFAULT_CONSTRUCTOR (   ClassType)    ClassType() = default;

默认构造函数宏 / Default constructor macro

Parameters
ClassType类名 / Class name
class MyClass {
public:
};
#define CPP_TOOLBOX_DEFAULT_CONSTRUCTOR(ClassType)
默认构造函数宏 / Default constructor macro
Definition class.hpp:62

◆ CPP_TOOLBOX_DELETE_CONSTRUCTOR

#define CPP_TOOLBOX_DELETE_CONSTRUCTOR (   ClassType)
Value:
ClassType(const ClassType&) = delete; \
ClassType(ClassType&&) = delete;

删除拷贝和移动构造函数 / Delete copy and move constructors

Parameters
ClassType类名 / Class name
class MyClass {
public:
};
#define CPP_TOOLBOX_DELETE_CONSTRUCTOR(ClassType)
删除拷贝和移动构造函数 / Delete copy and move constructors
Definition class.hpp:75

◆ CPP_TOOLBOX_DISABLE_COPY

#define CPP_TOOLBOX_DISABLE_COPY (   ClassType)
Value:
ClassType(const ClassType&) = delete; \
ClassType& operator=(const ClassType&) = delete;

禁用类的拷贝操作 / Disable copy operations for a class

Parameters
ClassType类名 / Class name
class MyClass {
public:
MyClass() = default;
};
#define CPP_TOOLBOX_DISABLE_COPY(ClassType)
禁用类的拷贝操作 / Disable copy operations for a class
Definition class.hpp:15
Examples
/home/runner/work/cpp-toolbox/cpp-toolbox/src/include/cpp-toolbox/base/thread_pool.hpp.

◆ CPP_TOOLBOX_DISABLE_COPY_AND_MOVE

#define CPP_TOOLBOX_DISABLE_COPY_AND_MOVE (   ClassType)
Value:
CPP_TOOLBOX_DISABLE_MOVE(ClassType)

禁用类的拷贝和移动操作 / Disable both copy and move operations

Parameters
ClassType类名 / Class name
class MyClass {
public:
MyClass() = default;
};
#define CPP_TOOLBOX_DISABLE_COPY_AND_MOVE(ClassType)
禁用类的拷贝和移动操作 / Disable both copy and move operations
Definition class.hpp:47
Examples
/home/runner/work/cpp-toolbox/cpp-toolbox/src/include/cpp-toolbox/container/lock_free_queue.hpp.

◆ CPP_TOOLBOX_DISABLE_MOVE

#define CPP_TOOLBOX_DISABLE_MOVE (   ClassType)
Value:
ClassType(ClassType&&) = delete; \
ClassType& operator=(ClassType&&) = delete;

禁用类的移动操作 / Disable move operations for a class

Parameters
ClassType类名 / Class name
class MyClass {
public:
MyClass() = default;
};
#define CPP_TOOLBOX_DISABLE_MOVE(ClassType)
禁用类的移动操作 / Disable move operations for a class
Definition class.hpp:31
Examples
/home/runner/work/cpp-toolbox/cpp-toolbox/src/include/cpp-toolbox/base/thread_pool.hpp.

◆ CPP_TOOLBOX_SINGLETON

#define CPP_TOOLBOX_SINGLETON (   ClassType)
Value:
public: \
static ClassType& instance() \
{ \
static ClassType instance; \
return instance; \
} \
\
private: \
ClassType() = default; \
CPP_TOOLBOX_DISABLE_COPY(ClassType) \
CPP_TOOLBOX_DISABLE_MOVE(ClassType)

单例模式宏 / Singleton pattern macro

Parameters
ClassType类名 / Class name
class MySingleton {
CPP_TOOLBOX_SINGLETON(MySingleton)
public:
void doSomething() {}
};
// 使用单例 / Using singleton
MySingleton::instance().doSomething();
#define CPP_TOOLBOX_SINGLETON(ClassType)
单例模式宏 / Singleton pattern macro
Definition class.hpp:94