18 #ifndef OBJECT_CACHE_GUARD 19 #define OBJECT_CACHE_GUARD 71 return auto_ptr<T>(
new T());
73 auto_ptr<T> object(
_cache.back());
78 template<
class T>
template<
class S>
81 return auto_ptr<T>(
new T(copyOf));
83 auto_ptr<T> object(
_cache.back());
89 template<
class T>
template<
class S>
91 ASSERT(dynamic_cast<T*>(
object.
get()) != 0);
93 auto_ptr<T> casted(static_cast<T*>(
object.release()));
void noThrowPushBack(Container &container, auto_ptr< Element > pointer)
auto_ptr< T > newObject()
Returns an object.
void freeObject(auto_ptr< S > object)
Insert an object into the cache.
auto_ptr< T > newObjectCopy(const S ©Of)
Returns a copy of copyOf.
ElementDeleter< vector< T * > > _cacheDeleter
An ObjectCache keeps a cache of previously-used objects to cut down on the number of allocations...