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
368  { // destroy the list
369  void *_Ptr;
370  while ((_Ptr = _Fl.pop()) != 0)
371  ::operator delete(_Ptr);
372  }
freelist< _Sz, _Max > _Fl
Definition: allocators:404

Member Function Documentation

template<size_t _Sz, class _Max >
_DECLSPEC_ALLOCATOR void* stdext::allocators::cache_freelist< _Sz, _Max >::allocate ( size_t  _Count)
inline
375  { // pop from free list or allocate from free store
376  void *_Res = _Fl.pop();
377  if (_Res == 0)
378  { // free list empty, allocate from free store
379  if (_Count < sizeof (void *))
380  _Res = ::operator new(sizeof (void *));
381  else
382  _Res = ::operator new(_Count);
383 
384  _Fl.allocated();
385  }
386  return (_Res);
387  }
freelist< _Sz, _Max > _Fl
Definition: allocators:404
_Diff _Count
Definition: algorithm:1941
template<size_t _Sz, class _Max >
void stdext::allocators::cache_freelist< _Sz, _Max >::deallocate ( void _Ptr,
size_t   
)
inline
390  { // push onto free list or deallocate to free store
391  if (!_Fl.push(_Ptr))
392  { // free list full, deallocate to free store
393  ::operator delete(_Ptr);
394  _Fl.deallocated();
395  }
396  }
freelist< _Sz, _Max > _Fl
Definition: allocators:404
template<size_t _Sz, class _Max >
bool stdext::allocators::cache_freelist< _Sz, _Max >::equals ( const cache_freelist< _Sz, _Max > &  ) const
inline
399  { // report that caches can share data
400  return (true);
401  }

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: