STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Attributes | List of all members
stdext::allocators::cache_freelist< _Sz, _Max > Class Template Reference

Public Member Functions

 ~cache_freelist () _NOEXCEPT
 
_DECLSPEC_ALLOCATOR voidallocate (size_t _Count)
 
void deallocate (void *_Ptr, size_t)
 
bool equals (const cache_freelist< _Sz, _Max > &) const
 

Private Attributes

freelist< _Sz, _Max > _Fl
 

Constructor & Destructor Documentation

template<size_t _Sz, class _Max >
stdext::allocators::cache_freelist< _Sz, _Max >::~cache_freelist ( )
inline
364  { // destroy the list
365  void *_Ptr;
366  while ((_Ptr = _Fl.pop()) != 0)
367  ::operator delete(_Ptr);
368  }
freelist< _Sz, _Max > _Fl
Definition: allocators:400

Member Function Documentation

template<size_t _Sz, class _Max >
_DECLSPEC_ALLOCATOR void* stdext::allocators::cache_freelist< _Sz, _Max >::allocate ( size_t  _Count)
inline
371  { // pop from free list or allocate from free store
372  void *_Res = _Fl.pop();
373  if (_Res == 0)
374  { // free list empty, allocate from free store
375  if (_Count < sizeof (void *))
376  _Res = ::operator new(sizeof (void *));
377  else
378  _Res = ::operator new(_Count);
379 
380  _Fl.allocated();
381  }
382  return (_Res);
383  }
unsigned int _Count
Definition: xcomplex:668
freelist< _Sz, _Max > _Fl
Definition: allocators:400
template<size_t _Sz, class _Max >
void stdext::allocators::cache_freelist< _Sz, _Max >::deallocate ( void _Ptr,
size_t   
)
inline
386  { // push onto free list or deallocate to free store
387  if (!_Fl.push(_Ptr))
388  { // free list full, deallocate to free store
389  ::operator delete(_Ptr);
390  _Fl.deallocated();
391  }
392  }
freelist< _Sz, _Max > _Fl
Definition: allocators:400
template<size_t _Sz, class _Max >
bool stdext::allocators::cache_freelist< _Sz, _Max >::equals ( const cache_freelist< _Sz, _Max > &  ) const
inline
395  { // report that caches can share data
396  return (true);
397  }

Member Data Documentation

template<size_t _Sz, class _Max >
freelist<_Sz, _Max> stdext::allocators::cache_freelist< _Sz, _Max >::_Fl
private

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