16 #ifndef BT_ALIGNED_ALLOCATOR 17 #define BT_ALIGNED_ALLOCATOR 25 #ifdef BT_DEBUG_MEMORY_ALLOCATIONS 27 #define btAlignedAlloc(a,b) \ 28 btAlignedAllocInternal(a,b,__LINE__,__FILE__) 30 #define btAlignedFree(ptr) \ 31 btAlignedFreeInternal(ptr,__LINE__,__FILE__) 41 #define btAlignedAlloc(size,alignment) btAlignedAllocInternal(size,alignment) 42 #define btAlignedFree(ptr) btAlignedFreeInternal(ptr) 60 template <
typename T ,
unsigned Alignment >
73 template <
typename Other >
82 pointer
address ( reference ref )
const {
return &ref; }
83 const_pointer
address ( const_reference ref )
const {
return &ref; }
86 return reinterpret_cast< pointer
>(
btAlignedAlloc(
sizeof(value_type) * n , Alignment ));
92 void destroy ( pointer ptr ) { ptr->~value_type(); }
95 template <
typename O >
struct rebind {
98 template <
typename O >
101 friend bool operator==(
const self_type & ,
const self_type & ) {
return true; }
106 #endif //BT_ALIGNED_ALLOCATOR btAlignedAllocator< T, Alignment > self_type
void deallocate(pointer ptr)
void destroy(pointer ptr)
btAlignedAllocator(const btAlignedAllocator< Other, Alignment > &)
friend bool operator==(const self_type &, const self_type &)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void btAlignedAllocSetCustom(btAllocFunc *allocFunc, btFreeFunc *freeFunc)
The developer can let all Bullet memory allocations go through a custom memory allocator, using btAlignedAllocSetCustom.
void * btAlignedAllocInternal(size_t size, int alignment)
we probably replace this with our own aligned memory allocator so we replace _aligned_malloc and _ali...
const T & const_reference
void btAlignedFreeInternal(void *ptr)
void( btFreeFunc)(void *memblock)
void *( btAlignedAllocFunc)(size_t size, int alignment)
self_type & operator=(const btAlignedAllocator< O, Alignment > &)
void( btAlignedFreeFunc)(void *memblock)
pointer address(reference ref) const
#define btAlignedFree(ptr)
void *( btAllocFunc)(size_t size)
void btAlignedAllocSetCustomAligned(btAlignedAllocFunc *allocFunc, btAlignedFreeFunc *freeFunc)
If the developer has already an custom aligned allocator, then btAlignedAllocSetCustomAligned can be ...
btAlignedAllocator< O, Alignment > other
void construct(pointer ptr, const value_type &value)
const_pointer address(const_reference ref) const
The btAlignedAllocator is a portable class for aligned memory allocations.
#define btAlignedAlloc(size, alignment)
pointer allocate(size_type n, const_pointer *hint=0)