From c701adbd241ea84d6f64842e8015c1009a41d786 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 24 Apr 2014 21:34:45 +0200 Subject: Initial C++ SSL classes. --- src/Globals.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Globals.h') diff --git a/src/Globals.h b/src/Globals.h index 26a0d87a9..3d7c9707c 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -264,9 +264,11 @@ template class SizeChecker; // Same as assert but in all Self test builds #ifdef SELF_TEST -#define assert_test(x) ( !!(x) || (assert(!#x), exit(1), 0)) + #define assert_test(x) ( !!(x) || (assert(!#x), exit(1), 0)) #endif +#define SharedPtr std::tr1::shared_ptr + @@ -296,7 +298,7 @@ T Clamp(T a_Value, T a_Min, T a_Max) #ifndef TOLUA_TEMPLATE_BIND -#define TOLUA_TEMPLATE_BIND(x) + #define TOLUA_TEMPLATE_BIND(x) #endif -- cgit v1.2.3 From a02e8e8021147783b011d9a2f99ba3f1128ae8e8 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 24 Apr 2014 22:30:19 +0200 Subject: Declared a SharedPtr that hopefully resolves on all platforms. MSVC2008 has it in std::tr1, all the others in std. --- src/Globals.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Globals.h') diff --git a/src/Globals.h b/src/Globals.h index 3d7c9707c..2e7e0c9cf 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -267,7 +267,15 @@ template class SizeChecker; #define assert_test(x) ( !!(x) || (assert(!#x), exit(1), 0)) #endif -#define SharedPtr std::tr1::shared_ptr +// Allow both Older versions of MSVC and newer versions of everything use a shared_ptr: +// Note that we cannot typedef, because C++ doesn't allow (partial) templates to be typedeffed. +#if (defined(_MSC_VER) && (_MSC_VER < 1600)) + // MSVC before 2010 doesn't have std::shared_ptr, but has std::tr1::shared_ptr + #define SharedPtr std::tr1::shared_ptr +#else + // All others have std::shared ptr + #define SharedPtr std::shared_ptr +#endif -- cgit v1.2.3 From f3dfc0349d7008efa50855c739d86918bdbf4a88 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 25 Apr 2014 09:48:52 +0200 Subject: Added shared_ptr handling for C++03 mode. --- src/Globals.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Globals.h') diff --git a/src/Globals.h b/src/Globals.h index 2e7e0c9cf..93baf69ea 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -270,11 +270,15 @@ template class SizeChecker; // Allow both Older versions of MSVC and newer versions of everything use a shared_ptr: // Note that we cannot typedef, because C++ doesn't allow (partial) templates to be typedeffed. #if (defined(_MSC_VER) && (_MSC_VER < 1600)) - // MSVC before 2010 doesn't have std::shared_ptr, but has std::tr1::shared_ptr + // MSVC before 2010 doesn't have std::shared_ptr, but has std::tr1::shared_ptr, defined in included earlier #define SharedPtr std::tr1::shared_ptr -#else - // All others have std::shared ptr +#elif (__cplusplus > 201103L) + // C++11 has std::shared_ptr in , included earlier #define SharedPtr std::shared_ptr +#else + // C++03 has std::tr1::shared_ptr in + #include + #define SharedPtr std::tr1::shared_ptr #endif -- cgit v1.2.3 From 6d167b370e409d77eb2b9e02bc95b80463670823 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 25 Apr 2014 16:05:24 +0200 Subject: Fixed C++11 check for SharedPtr. --- src/Globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Globals.h') diff --git a/src/Globals.h b/src/Globals.h index 93baf69ea..a09819ce9 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -272,7 +272,7 @@ template class SizeChecker; #if (defined(_MSC_VER) && (_MSC_VER < 1600)) // MSVC before 2010 doesn't have std::shared_ptr, but has std::tr1::shared_ptr, defined in included earlier #define SharedPtr std::tr1::shared_ptr -#elif (__cplusplus > 201103L) +#elif (__cplusplus >= 201103L) // C++11 has std::shared_ptr in , included earlier #define SharedPtr std::shared_ptr #else -- cgit v1.2.3 From a2cffb0363e42f12019712297e764a269b6a7d9a Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 1 May 2014 20:21:54 +0200 Subject: Fixed MSVC2013 compilation. --- src/Globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Globals.h') diff --git a/src/Globals.h b/src/Globals.h index a09819ce9..71e9191e4 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -272,7 +272,7 @@ template class SizeChecker; #if (defined(_MSC_VER) && (_MSC_VER < 1600)) // MSVC before 2010 doesn't have std::shared_ptr, but has std::tr1::shared_ptr, defined in included earlier #define SharedPtr std::tr1::shared_ptr -#elif (__cplusplus >= 201103L) +#elif (defined(_MSC_VER) || (__cplusplus >= 201103L)) // C++11 has std::shared_ptr in , included earlier #define SharedPtr std::shared_ptr #else -- cgit v1.2.3