max_fixed_size Class

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Describes a max class object that limits a freelist object to a fixed maximum length.

template <std::size_t Max>  
class max_fixed_size

Parameters

ParameterDescription
MaxThe max class that determines the maximum number of elements to store in the freelist.

Constructors

max_fixed_sizeConstructs an object of type max_fixed_size.

Member Functions

allocatedIncrements the count of allocated memory blocks.
deallocatedDecrements the count of allocated memory blocks.
fullReturns a value that specifies whether more memory blocks should be added to the free list.
releasedDecrements the count of memory blocks on the free list.
savedIncrements the count of memory blocks on the free list.

Header: <allocators>

Namespace: stdext

Increments the count of allocated memory blocks.

void allocated(std::size_t _Nx = 1);

Parameters

ParameterDescription
_NxThe increment value.

Remarks

The member function does nothing. This member function is called after each successful call by cache_freelist::allocate to operator new. The argument _Nx is the number of memory blocks in the chunk allocated by operator new.

Decrements the count of allocated memory blocks.

void deallocated(std::size_t _Nx = 1);

Parameters

ParameterDescription
_NxThe increment value.

Remarks

The member function does nothing. This member function is called after each call by cache_freelist::deallocate to operator delete. The argument _Nx is the number of memory blocks in the chunk deallocated by operator delete.

Returns a value that specifies whether more memory blocks should be added to the free list.

bool full();

Return Value

true if Max <= _Nblocks; otherwise, false.

Remarks

This member function is called by cache_freelist::deallocate. If the call returns true, deallocate puts the memory block on the free list; if it returns false, deallocate calls operator delete to deallocate the block.

Constructs an object of type max_fixed_size.

max_fixed_size();

Remarks

This constructor initializes the stored value _Nblocks to zero.

Decrements the count of memory blocks on the free list.

void released();

Remarks

Decrements the stored value _Nblocks. The released member function of the current max class is called by cache_freelist::allocate whenever it removes a memory block from the free list.

Increments the count of memory blocks on the free list.

void saved();

Remarks

This member function increments the stored value _Nblocks. This member function is called by cache_freelist::deallocate whenever it puts a memory block on the free list.

<allocators>

Show: