28#ifndef __SharedPtr_H__
29#define __SharedPtr_H__
157 assert(!
"Bad method");
201#if __cplusplus >= 201103L
203 class =
typename std::enable_if<std::is_convertible<Y*, T*>::value>::type>
218#if __cplusplus >= 201103L
220 class =
typename std::enable_if<std::is_assignable<T*, Y*>::value>::type>
255 Y* rep =
dynamic_cast<Y*
>(
pRep);
328 return a.
get() == b.
get();
333 return a.
get() != b.
get();
338 return std::less<const void*>()(a.
get(), b.
get());
SharedPtrInfoDeleteT(T *o)
virtual ~SharedPtrInfoDeleteT()
SharedPtrInfoDelete(T *o)
virtual ~SharedPtrInfoDelete()
virtual ~SharedPtrInfoFree()
Reference-counted shared pointer, used for objects where implicit destruction is required.
SharedPtr & operator=(const SharedPtr< Y > &r)
SharedPtr(T *rep, SharedPtrInfo *info)
void setUseCount(unsigned value)
void destroy(void)
IF YOU GET A CRASH HERE, YOU FORGOT TO FREE UP POINTERS BEFORE SHUTTING OGRE DOWN Use setNull() befor...
SharedPtr()
Constructor, does not initialise the SharedPtr.
static SharedPtrInfo * createInfoForMethod(T *rep, SharedPtrFreeMethod method)
void swap(SharedPtr< T > &other)
unsigned int useCount() const
SharedPtr(Y *rep, SharedPtrFreeMethod inFreeMethod=SPFM_DELETE)
Constructor.
SharedPtr & operator=(const SharedPtr &r)
SharedPtr(const SharedPtr &r)
SharedPtr< Y > dynamicCast() const
void bind(T *rep, SharedPtrFreeMethod inFreeMethod=SPFM_DELETE)
Binds rep to the SharedPtr.
SharedPtr(const SharedPtr< Y > &r)
SharedPtr< Y > staticCast() const
SharedPtrFreeMethod
The method to use to free memory on destruction.
bool operator<(SharedPtr< T > const &a, SharedPtr< U > const &b)
@ SPFM_NONE
Don`t free resource at all, lifetime controlled externally.
@ SPFM_DELETE_T
Use OGRE_DELETE_T to free (only MEMCATEGORY_GENERAL supported)
@ SPFM_DELETE
Use OGRE_DELETE to free the memory.
@ SPFM_FREE
Use OGRE_FREE to free (only MEMCATEGORY_GENERAL supported)
#define OGRE_DELETE_T(ptr, T, category)
Free the memory allocated with OGRE_NEW_T. Category is required to be restated to ensure the matching...
bool operator!=(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator,...
#define OGRE_NEW_T(T, category)
Allocate space for one primitive type, external type or non-virtual type with constructor parameters.
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator,...
#define OGRE_FREE(ptr, category)
Free the memory allocated with OGRE_MALLOC or OGRE_ALLOC_T. Category is required to be restated to en...
@ MEMCATEGORY_GENERAL
General purpose.
void swap(Ogre::SmallVectorImpl< T > &LHS, Ogre::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.
AtomicScalar< unsigned > useCount