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
 
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
358  { // destroy the list
359  void *_Ptr;
360  while ((_Ptr = _Fl.pop()) != 0)
361  ::operator delete(_Ptr);
362  }
freelist< _Sz, _Max > _Fl
Definition: allocators:394

Member Function Documentation

template<size_t _Sz, class _Max >
void* stdext::allocators::cache_freelist< _Sz, _Max >::allocate ( size_t  _Count)
inline
365  { // pop from free list or allocate from free store
366  void *_Res = _Fl.pop();
367  if (_Res == 0)
368  { // free list empty, allocate from free store
369  if (_Count < sizeof (void *))
370  _Res = ::operator new(sizeof (void *));
371  else
372  _Res = ::operator new(_Count);
373 
374  _Fl.allocated();
375  }
376  return (_Res);
377  }
freelist< _Sz, _Max > _Fl
Definition: allocators:394
_Diff _Count
Definition: algorithm:1941
template<size_t _Sz, class _Max >
void stdext::allocators::cache_freelist< _Sz, _Max >::deallocate ( void _Ptr,
size_t   
)
inline
380  { // push onto free list or deallocate to free store
381  if (!_Fl.push(_Ptr))
382  { // free list full, deallocate to free store
383  ::operator delete(_Ptr);
384  _Fl.deallocated();
385  }
386  }
freelist< _Sz, _Max > _Fl
Definition: allocators:394
template<size_t _Sz, class _Max >
bool stdext::allocators::cache_freelist< _Sz, _Max >::equals ( const cache_freelist< _Sz, _Max > &  ) const
inline
389  { // report that caches can share data
390  return (true);
391  }

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: