From c56d7fe0eba7905b0a63c4a1cfe909988653c23d Mon Sep 17 00:00:00 2001 From: kwolekr Date: Tue, 27 Oct 2015 02:51:43 -0400 Subject: Add DISABLE_CLASS_COPY macro (and use it) Use this macro to disallow copying of an object using the assignment operator or copy constructor. This catches otherwise silent-but-deadly mistakes such as "ServerMap map = env->getMap();" at compile time. If so desired, it is still possible to copy a class, but it now requires an explicit call to memcpy or std::copy. --- src/threading/mutex.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/threading/mutex.h') diff --git a/src/threading/mutex.h b/src/threading/mutex.h index 4c9af71bf..f1a4882b7 100644 --- a/src/threading/mutex.h +++ b/src/threading/mutex.h @@ -44,6 +44,7 @@ DEALINGS IN THE SOFTWARE. #include #endif +#include "basicmacros.h" class Mutex { @@ -59,6 +60,8 @@ private: #else // pthread pthread_mutex_t mutex; #endif + + DISABLE_CLASS_COPY(Mutex); }; #endif // C++11 -- cgit v1.2.3