Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
STLAllocator< T > Class Template Reference

STL allocator that forwards to our allocation functions. More...

#include <STLAllocator.h>

Inheritance diagram for STLAllocator< T >:
Array< IndexedTriangle > Array< ResultType > Array< Body * > Array< uint8 > Array< BodyID > Array< Mapping > Array< const char * > Array< BroadPhaseLayer > Array< Contact > Array< CharacterVirtual * > Array< SubShape > Array< SubShapeSettings > Array< Ref< Constraint > > Array< Face * > Array< Coplanar > Array< int > Array< Point > Array< Face > Array< Plane > Array< Vec3 > Array< DebugRenderer::LOD > Array< DebugRendererRecorder::Frame > Array< DebugRendererRecorder::LineBlob > Array< DebugRendererRecorder::TriangleBlob > Array< DebugRendererRecorder::TextBlob > Array< DebugRendererRecorder::GeometryBlob > Array< Triangle > Array< float > Array< RefConst< PhysicsMaterial > > Array< Ref > Array< thread > Array< Float3 > Array< Bounds > Array< Link > Array< AttributeDescription > Array< BodyCreationSettings > Array< PhysicsScene::ConnectedConstraint > Array< SoftBodyCreationSettings > Array< PhysicsStepListener * > Array< ProfileThread * > Array< Ref< TwoBodyConstraint > > Array< Part > Array< AdditionalConstraint > Array< BodyIdxPair > Array< AnimatedJoint > Array< Keyframe > Array< Joint > Array< Chain > Array< Unmapped > Array< Locked > Array< JointState > Array< Mat44 > Array< SoftBodyVertex > Array< CollidingShape > Array< CollidingSensor > Array< SkinState > Array< SoftBodySharedSettings::Vertex > Array< SoftBodySharedSettings::Face > Array< SoftBodySharedSettings::Edge > Array< SoftBodySharedSettings::DihedralBend > Array< SoftBodySharedSettings::Volume > Array< SoftBodySharedSettings::Skinned > Array< SoftBodySharedSettings::InvBind > Array< SoftBodySharedSettings::LRA > Array< ClosestKinematic > Array< UpdateGroup > Array< uint32 > Array< uint > Array< Node > Array< Bin > Array< Wheel * > Array< VehicleAntiRollBar > Array< Ref< WheelSettings > > Array< VehicleDifferentialSettings > Array< T, Allocator >

Classes

struct  rebind
 Converting to allocator for other type. More...
 

Public Types

using value_type = T
 
using pointer = T *
 Pointer to type.
 
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::true_type
 The allocator is stateless.
 
using propagate_on_container_move_assignment = std::true_type
 Allocator supports moving.
 

Public Member Functions

 STLAllocator ()=default
 Constructor.
 
template<typename T2 >
 STLAllocator (const STLAllocator< T2 > &)
 Constructor from other allocator.
 
pointer allocate (size_type inN)
 Allocate memory.
 
template<bool has_reallocate_v = has_reallocate, typename = std::enable_if_t<has_reallocate_v>>
pointer reallocate (pointer inOldPointer, size_type inOldSize, size_type inNewSize)
 Reallocate memory.
 
void deallocate (pointer inPointer, size_type)
 Free memory.
 
bool operator== (const STLAllocator< T > &) const
 Allocators are stateless so assumed to be equal.
 
bool operator!= (const STLAllocator< T > &) const
 

Static Public Attributes

static constexpr bool needs_aligned_allocate = alignof(T) > (JPH_CPU_ADDRESS_BITS == 32? 8 : 16)
 If this allocator needs to fall back to aligned allocations because the type requires it.
 
static constexpr bool has_reallocate = std::is_trivially_copyable<T>() && !needs_aligned_allocate
 Should we expose a reallocate function?
 

Detailed Description

template<typename T>
class STLAllocator< T >

STL allocator that forwards to our allocation functions.

Member Typedef Documentation

◆ const_pointer

template<typename T >
using STLAllocator< T >::const_pointer = const T *

◆ const_reference

template<typename T >
using STLAllocator< T >::const_reference = const T &

◆ difference_type

template<typename T >
using STLAllocator< T >::difference_type = ptrdiff_t

◆ is_always_equal

template<typename T >
using STLAllocator< T >::is_always_equal = std::true_type

The allocator is stateless.

◆ pointer

template<typename T >
using STLAllocator< T >::pointer = T *

Pointer to type.

◆ propagate_on_container_move_assignment

template<typename T >
using STLAllocator< T >::propagate_on_container_move_assignment = std::true_type

Allocator supports moving.

◆ reference

template<typename T >
using STLAllocator< T >::reference = T &

Reference to type. Can be removed in C++20.

◆ size_type

template<typename T >
using STLAllocator< T >::size_type = size_t

◆ value_type

template<typename T >
using STLAllocator< T >::value_type = T

Constructor & Destructor Documentation

◆ STLAllocator() [1/2]

template<typename T >
STLAllocator< T >::STLAllocator ( )
inlinedefault

Constructor.

◆ STLAllocator() [2/2]

template<typename T >
template<typename T2 >
STLAllocator< T >::STLAllocator ( const STLAllocator< T2 > &  )
inline

Constructor from other allocator.

Member Function Documentation

◆ allocate()

template<typename T >
pointer STLAllocator< T >::allocate ( size_type  inN)
inline

Allocate memory.

◆ deallocate()

template<typename T >
void STLAllocator< T >::deallocate ( pointer  inPointer,
size_type   
)
inline

Free memory.

◆ operator!=()

template<typename T >
bool STLAllocator< T >::operator!= ( const STLAllocator< T > &  ) const
inline

◆ operator==()

template<typename T >
bool STLAllocator< T >::operator== ( const STLAllocator< T > &  ) const
inline

Allocators are stateless so assumed to be equal.

◆ reallocate()

template<typename T >
template<bool has_reallocate_v = has_reallocate, typename = std::enable_if_t<has_reallocate_v>>
pointer STLAllocator< T >::reallocate ( pointer  inOldPointer,
size_type  inOldSize,
size_type  inNewSize 
)
inline

Reallocate memory.

Member Data Documentation

◆ has_reallocate

template<typename T >
constexpr bool STLAllocator< T >::has_reallocate = std::is_trivially_copyable<T>() && !needs_aligned_allocate
staticconstexpr

Should we expose a reallocate function?

◆ needs_aligned_allocate

template<typename T >
constexpr bool STLAllocator< T >::needs_aligned_allocate = alignof(T) > (JPH_CPU_ADDRESS_BITS == 32? 8 : 16)
staticconstexpr

If this allocator needs to fall back to aligned allocations because the type requires it.


The documentation for this class was generated from the following file: