rts_alloc Class

 

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

The rts_alloc template class describes a filter that holds an array of cache instances and determines which instance to use for allocation and deallocation at runtime instead of at compile time.

template <class Cache>  
class rts_alloc

Parameters

ParameterDescription
CacheThe type of cache instances contained in the array. This can be cache_chunklist Class, cache_freelist, or cache_suballoc.

This template class holds multiple block allocator instances and determines which instance to use for allocation or deallocation at runtime instead of at compile time. It is used with compilers that cannot compile rebind.

Member Functions

allocateAllocates a block of memory.
deallocateFrees a specified number of objects from storage beginning at a specified position.
equalsCompares two caches for equality.

Header: <allocators>

Namespace: stdext

Allocates a block of memory.

void *allocate(std::size_t count);

Parameters

ParameterDescription
countThe number of elements in the array to be allocated.

Return Value

A pointer to the allocated object.

Remarks

The member function returns caches[_IDX].allocate(count), where the index _IDX is determined by the requested block size count, or, if count is too large, it returns operator new(count). cache, which represents the cache object.

Frees a specified number of objects from storage beginning at a specified position.

void deallocate(void* ptr, std::size_t count);

Parameters

ParameterDescription
ptrA pointer to the first object to be deallocated from storage.
countThe number of objects to be deallocated from storage.

Remarks

The member function calls caches[_IDX].deallocate(ptr, count), where the index _IDX is determined by the requested block size count, or, if count is too large, it returns operator delete(ptr).

Compares two caches for equality.

bool equals(const sync<_Cache>& _Other) const;

Parameters

ParameterDescription
_CacheThe cache object associated with the filter.
_OtherThe cache object to compare for equality.

Remarks

true if the result of caches[0].equals(other.caches[0]); otherwise, false. caches represents the array of cache objects.

ALLOCATOR_DECL
<allocators>

Show: