Merge "DISALLOW_COPY_AND_ASSIGN macro now uses the delete keyword and allows move assignment and construction"

This commit is contained in:
Brad Miller (WPI)
2015-07-07 16:49:23 -07:00
committed by Gerrit Code Review
2 changed files with 12 additions and 10 deletions

View File

@@ -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 }

View File

@@ -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