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) 59 template <
typename T,
unsigned Alignment>
71 template <
typename Other>
80 pointer
address(reference ref)
const {
return &ref; }
81 const_pointer
address(const_reference ref)
const {
return &ref; }
85 return reinterpret_cast<pointer
>(
btAlignedAlloc(
sizeof(value_type) * n, Alignment));
92 void destroy(pointer ptr) { ptr->~value_type(); }
101 friend bool operator==(
const self_type&,
const self_type&) {
return true; }
104 #endif //BT_ALIGNED_ALLOCATOR void * btAlignedAllocInternal(size_t size, int32_t alignment)
pointer address(reference ref) const
Definition: btAlignedAllocator.h:80
Definition: btAlignedAllocator.h:60
Definition: btAlignedAllocator.h:95
void *() btAllocFunc(size_t size)
Definition: btAlignedAllocator.h:49
btAlignedAllocator()
Definition: btAlignedAllocator.h:66
T * pointer
Definition: btAlignedAllocator.h:76
void destroy(pointer ptr)
Definition: btAlignedAllocator.h:92
void btAlignedAllocSetCustomAligned(btAlignedAllocFunc *allocFunc, btAlignedFreeFunc *freeFunc)
If the developer has already an custom aligned allocator, then btAlignedAllocSetCustomAligned can be ...
const T * const_pointer
Definition: btAlignedAllocator.h:74
const T & const_reference
Definition: btAlignedAllocator.h:75
void deallocate(pointer ptr)
Definition: btAlignedAllocator.h:88
pointer allocate(size_type n, const_pointer *hint=0)
Definition: btAlignedAllocator.h:82
self_type & operator=(const btAlignedAllocator< O, Alignment > &)
Definition: btAlignedAllocator.h:99
#define btAlignedFree(ptr)
Definition: btAlignedAllocator.h:42
void btAlignedFreeInternal(void *ptr)
btAlignedAllocator(const btAlignedAllocator< Other, Alignment > &)
Definition: btAlignedAllocator.h:72
T & reference
Definition: btAlignedAllocator.h:77
btAlignedAllocator< O, Alignment > other
Definition: btAlignedAllocator.h:96
void() btAlignedFreeFunc(void *memblock)
Definition: btAlignedAllocator.h:48
void() btFreeFunc(void *memblock)
Definition: btAlignedAllocator.h:50
void construct(pointer ptr, const value_type &value)
Definition: btAlignedAllocator.h:87
int32_t size_type
Definition: btAlignedAllocator.h:45
friend bool operator==(const self_type &, const self_type &)
Definition: btAlignedAllocator.h:101
void *() btAlignedAllocFunc(size_t size, int32_t alignment)
Definition: btAlignedAllocator.h:47
#define btAlignedAlloc(size, alignment)
Definition: btAlignedAllocator.h:41
const_pointer address(const_reference ref) const
Definition: btAlignedAllocator.h:81
void btAlignedAllocSetCustom(btAllocFunc *allocFunc, btFreeFunc *freeFunc)
The developer can let all Bullet memory allocations go through a custom memory allocator, using btAlignedAllocSetCustom.
T value_type
Definition: btAlignedAllocator.h:78