Jolt Physics
A multi core friendly Game Physics Engine
|
STL allocator that keeps N elements in a local buffer before falling back to regular allocations. More...
#include <STLLocalAllocator.h>
Classes | |
struct | rebind |
Converting to allocator for other type. More... | |
Public Types | |
using | value_type = T |
General properties. | |
using | pointer = T * |
using | const_pointer = const T * |
using | reference = T & |
using | const_reference = const T & |
using | size_type = size_t |
using | difference_type = ptrdiff_t |
using | is_always_equal = std::false_type |
The allocator is not stateless (has local buffer) | |
using | propagate_on_container_copy_assignment = std::false_type |
We cannot copy, move or swap allocators. | |
using | propagate_on_container_move_assignment = std::false_type |
using | propagate_on_container_swap = std::false_type |
Public Member Functions | |
STLLocalAllocator ()=default | |
Constructor. | |
STLLocalAllocator (const STLLocalAllocator &)=delete | |
STLLocalAllocator (STLLocalAllocator &&)=delete | |
STLLocalAllocator & | operator= (const STLLocalAllocator &)=delete |
template<class T2 > | |
STLLocalAllocator (const STLLocalAllocator< T2, N > &) | |
bool | is_local (const_pointer inPointer) const |
Check if inPointer is in the local buffer. | |
pointer | allocate (size_type inN) |
Allocate memory. | |
pointer | reallocate (pointer inOldPointer, size_type inOldSize, size_type inNewSize) |
Reallocate memory. | |
void | deallocate (pointer inPointer, size_type inN) |
Free memory. | |
bool | operator== (const STLLocalAllocator< T, N > &inRHS) const |
Allocators are not-stateless, assume if allocator address matches that the allocators are the same. | |
bool | operator!= (const STLLocalAllocator< T, N > &inRHS) const |
Static Public Attributes | |
static constexpr bool | has_reallocate = true |
Always implements a reallocate function as we can often reallocate in place. | |
STL allocator that keeps N elements in a local buffer before falling back to regular allocations.
using STLLocalAllocator< T, N >::const_pointer = const T * |
using STLLocalAllocator< T, N >::const_reference = const T & |
using STLLocalAllocator< T, N >::difference_type = ptrdiff_t |
using STLLocalAllocator< T, N >::is_always_equal = std::false_type |
The allocator is not stateless (has local buffer)
using STLLocalAllocator< T, N >::pointer = T * |
using STLLocalAllocator< T, N >::propagate_on_container_copy_assignment = std::false_type |
We cannot copy, move or swap allocators.
using STLLocalAllocator< T, N >::propagate_on_container_move_assignment = std::false_type |
using STLLocalAllocator< T, N >::propagate_on_container_swap = std::false_type |
using STLLocalAllocator< T, N >::reference = T & |
using STLLocalAllocator< T, N >::size_type = size_t |
using STLLocalAllocator< T, N >::value_type = T |
General properties.
|
default |
Constructor.
|
delete |
|
delete |
|
inline |
Constructor used when rebinding to another type. This expects the allocator to use the original memory pool from the first allocator, but in our case we cannot use the local buffer of the original allocator as it has different size and alignment rules. To solve this we make this allocator fall back to the heap immediately.
|
inline |
Allocate memory.
|
inline |
Free memory.
|
inline |
Check if inPointer is in the local buffer.
|
inline |
|
delete |
|
inline |
Allocators are not-stateless, assume if allocator address matches that the allocators are the same.
|
inline |
Reallocate memory.
|
staticconstexpr |
Always implements a reallocate function as we can often reallocate in place.