Add macros to easily delete copy/move constructors
This commit is contained in:
18
src/lib/util/RestrictedConstructors.h
Normal file
18
src/lib/util/RestrictedConstructors.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef CHURLOS_RESTRICTEDCONSTRUCTORS_H
|
||||||
|
#define CHURLOS_RESTRICTEDCONSTRUCTORS_H
|
||||||
|
|
||||||
|
// Some convenience macros to easily delete copy/move constructors
|
||||||
|
|
||||||
|
#define MakeDefault(T) \
|
||||||
|
T() = default; \
|
||||||
|
~T() = default;
|
||||||
|
|
||||||
|
#define MakeUncopyable(T) \
|
||||||
|
T(const T ©) = delete; \
|
||||||
|
T &operator=(const T ©) = delete;
|
||||||
|
|
||||||
|
#define MakeUnmovable(T) \
|
||||||
|
T(T &&move) = delete;\
|
||||||
|
T &operator=(T &&move) = delete;
|
||||||
|
|
||||||
|
#endif //CHURLOS_RESTRICTEDCONSTRUCTORS_H
|
Reference in New Issue
Block a user