description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: freelist Class |
freelist Class |
11/04/2016 |
|
|
8ad7e35c-4c80-4479-8ede-1a2497b06d71 |
Manages a list of memory blocks.
template <std::size_t Sz, class Max>
class freelist : public Max
Sz
The number of elements in the array to be allocated.
Max
The max class representing the maximum number of elements to be stored in the free list. The max class can be max_none, max_unbounded, max_fixed_size, or max_variable_size.
This class template manages a list of memory blocks of size Sz with the maximum length of the list determined by the max class passed in Max.
Constructor | Description |
---|---|
freelist | Constructs an object of type freelist . |
Member function | Description |
---|---|
pop | Removes the first memory block from the free list. |
push | Adds a memory block to the list. |
Header: <allocators>
Namespace: stdext
Constructs an object of type freelist
.
freelist();
Removes the first memory block from the free list.
void *pop();
Returns a pointer to the memory block removed from the list.
The member function returns NULL if the list is empty. Otherwise, it removes the first memory block from the list.
Adds a memory block to the list.
bool push(void* ptr);
ptr
A pointer to the memory block to be added to the free list.
true
if the full
function of the max class returns false
; otherwise, the push
function returns false
.
If the full
function of the max class returns false
, this member function adds the memory block pointed to by ptr to the head of the list.