Browse Source

Added move semantics to cm_new which is the right way to do it (otherwise references would get actually passed by value)

Marko Pintera 12 years ago
parent
commit
21ee092f7a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      CamelotUtility/Include/CmMemoryAllocator.h

+ 2 - 2
CamelotUtility/Include/CmMemoryAllocator.h

@@ -94,7 +94,7 @@ namespace CamelotFramework
  */
 #define MAKE_CM_NEW(z, n, unused)                                     \
 	template<class Type, class Alloc BOOST_PP_ENUM_TRAILING_PARAMS(n, class T)>     \
-	Type* cm_new(BOOST_PP_ENUM_BINARY_PARAMS(n, T, t) ) { \
+	Type* cm_new(BOOST_PP_ENUM_BINARY_PARAMS(n, T, &&t) ) { \
 		return new (cm_alloc<Alloc>(sizeof(Type))) Type(BOOST_PP_ENUM_PARAMS (n, t));     \
 	}
 
@@ -180,7 +180,7 @@ namespace CamelotFramework
 	// Create a new object with the general allocator and the specified parameters.
 #define MAKE_CM_NEW(z, n, unused)                                     \
 	template<class Type BOOST_PP_ENUM_TRAILING_PARAMS(n, class T)>     \
-	Type* cm_new(BOOST_PP_ENUM_BINARY_PARAMS(n, T, t) ) { \
+	Type* cm_new(BOOST_PP_ENUM_BINARY_PARAMS(n, T, &&t) ) { \
 	return new (cm_alloc<GenAlloc>(sizeof(Type))) Type(BOOST_PP_ENUM_PARAMS (n, t));     \
 	}