41 virtual PxU8* allocate(PxU32 inSize) = 0;
42 virtual void deallocate( PxU8* inMem ) = 0;
44 template<
typename TObjectType>
45 TObjectType* allocate()
47 TObjectType* retval =
reinterpret_cast< TObjectType*
>( allocate(
sizeof( TObjectType ) ) );
48 new (retval) TObjectType();
52 template<
typename TObjectType,
typename TArgType>
53 TObjectType* allocate(
const TArgType &arg)
55 TObjectType* retval =
reinterpret_cast< TObjectType*
>( allocate(
sizeof( TObjectType ) ) );
56 new (retval) TObjectType(arg);
60 template<
typename TObjectType>
61 void deallocate( TObjectType* inObject )
63 deallocate(
reinterpret_cast<PxU8*
>( inObject ) );
65 template<
typename TObjectType>
66 inline TObjectType* batchAllocate(PxU32 inCount )
68 TObjectType* retval =
reinterpret_cast<TObjectType*
>( allocate(
sizeof(TObjectType) * inCount ) );
69 for ( PxU32 idx = 0; idx < inCount; ++idx )
71 new (retval + idx) TObjectType();
76 template<
typename TObjectType,
typename TArgType>
77 inline TObjectType* batchAllocate(PxU32 inCount,
const TArgType &arg)
79 TObjectType* retval =
reinterpret_cast<TObjectType*
>( allocate(
sizeof(TObjectType) * inCount ) );
80 for ( PxU32 idx = 0; idx < inCount; ++idx )
82 new (retval + idx) TObjectType(arg);
89 template<
typename TObjectType>
90 inline TObjectType* batchAllocate(TObjectType*, PxU32 inCount )
92 TObjectType* retval =
reinterpret_cast<TObjectType*
>( allocate(
sizeof(TObjectType) * inCount ) );
93 for ( PxU32 idx = 0; idx < inCount; ++idx )
95 new (retval + idx) TObjectType();
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39