From 769809e3a7e9e8e216ae16be723265d77d3a9a03 Mon Sep 17 00:00:00 2001 From: ejcoumans Date: Tue, 19 Jun 2007 23:41:01 +0000 Subject: [PATCH] disabled memcpy by default, it seems to be opening a can of worms, some platforms/compilers have it defined in , others in etc also for placement new, include rather then Thanks Marten Svanfeldt for the help --- src/LinearMath/btAlignedObjectArray.h | 41 ++++++++++++++------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/LinearMath/btAlignedObjectArray.h b/src/LinearMath/btAlignedObjectArray.h index 6e8ec3a88..ea46f6ecf 100644 --- a/src/LinearMath/btAlignedObjectArray.h +++ b/src/LinearMath/btAlignedObjectArray.h @@ -20,20 +20,23 @@ subject to the following restrictions: #include "btScalar.h" // has definitions like SIMD_FORCE_INLINE #include "btAlignedAllocator.h" -///If the platform doesn't support inplace new/memcpy, you can disable USE_NEW_INPLACE_NEW +///If the platform doesn't support placement new, you can disable BT_USE_PLACEMENT_NEW ///then the btAlignedObjectArray doesn't support objects with virtual methods, and non-trivial constructors/destructors -///see discussion here: http://continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=1231 -#define USE_NEW_INPLACE_NEW 1 +///You can enable BT_USE_MEMCPY, then swapping elements in the array will use memcpy instead of operator= +///see discussion here: http://continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=1231 and +///http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=1240 -#ifdef USE_NEW_INPLACE_NEW -#include //for replacement new +#define BT_USE_PLACEMENT_NEW 1 +//#define BT_USE_MEMCPY 1 //disable, because it is cumbersome to find out for each platform where memcpy is defined. It can be in or or otherwise... -#ifndef WIN32 -#include //for memcpy -#endif - -#endif //USE_NEW_INPLACE_NEW +#ifdef BT_USE_MEMCPY +#include +#include +#endif //BT_USE_MEMCPY +#ifdef BT_USE_PLACEMENT_NEW +#include //for placement new +#endif //BT_USE_PLACEMENT_NEW ///btAlignedObjectArray uses a subset of the stl::vector interface for its methods @@ -57,11 +60,11 @@ class btAlignedObjectArray { int i; for (i=start;i