From 65cdd7146fcccf71433594f298e2152f5baeef08 Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Mon, 8 Dec 2008 17:57:18 +0000 Subject: [PATCH] Use placement new for copy constructor of arrays. Thanks to M. Reuvers for the patch. http://bulletphysics.com/Bullet/phpBB3/viewforum.php?f=9 Generally, however, it is best to avoid copying entire arrays, but use a reference. typedef btAlignedObjectArray Array; Array a; Array b = a;//avoid this whenever possible This is much better: Array& b = a;//use a reference const Array& b = a; //or const reference --- src/LinearMath/btAlignedObjectArray.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/LinearMath/btAlignedObjectArray.h b/src/LinearMath/btAlignedObjectArray.h index afcc5da9d..e3d3e30c3 100644 --- a/src/LinearMath/btAlignedObjectArray.h +++ b/src/LinearMath/btAlignedObjectArray.h @@ -58,7 +58,7 @@ class btAlignedObjectArray { return (size ? size*2 : 1); } - SIMD_FORCE_INLINE void copy(int start,int end, T* dest) + SIMD_FORCE_INLINE void copy(int start,int end, T* dest) const { int i; for (i=start;i