diff --git a/hal/include/HAL/cpp/Synchronized.hpp b/hal/include/HAL/cpp/Synchronized.hpp index 351d6b1653..57fcb44386 100644 --- a/hal/include/HAL/cpp/Synchronized.hpp +++ b/hal/include/HAL/cpp/Synchronized.hpp @@ -7,11 +7,12 @@ #include "HAL/Semaphore.hpp" -// A macro to disallow the copy constructor and operator= functions -// This should be used in the private: declarations for a class -#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - void operator=(const TypeName&) +// A macro for making a class move-only +#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ + TypeName(const TypeName&) = delete; \ + TypeName& operator=(const TypeName&) = delete; \ + TypeName(TypeName&&) = default; \ + TypeName& operator=(TypeName&&) = default #define CRITICAL_REGION(s) { Synchronized _sync(s); #define END_REGION } diff --git a/wpilibc/wpilibC++/include/Base.h b/wpilibc/wpilibC++/include/Base.h index 168d140953..301b1ea38d 100644 --- a/wpilibc/wpilibC++/include/Base.h +++ b/wpilibc/wpilibC++/include/Base.h @@ -11,8 +11,9 @@ #define nullptr NULL #endif -// A macro to disallow the copy constructor and operator= functions -// This should be used in the private: declarations for a class -#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - void operator=(const TypeName&) +// A macro for making a class move-only +#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ + TypeName(const TypeName&) = delete; \ + TypeName& operator=(const TypeName&) = delete; \ + TypeName(TypeName&&) = default; \ + TypeName& operator=(TypeName&&) = default