czaloj / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

copy constructor of btAlignedObjectArray needs to use placement new #160

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Currently, the copy constructor doesn't call the constructor/destructor for 
elements. it should use placement new.

See 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<btSomeClass> 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

Original issue reported on code.google.com by erwin.coumans on 8 Dec 2008 at 5:53

GoogleCodeExporter commented 9 years ago

Original comment by erwin.coumans on 8 Dec 2008 at 6:02