Skip to content

Latest commit

 

History

History
111 lines (82 loc) · 2.9 KB

allocators-functions.md

File metadata and controls

111 lines (82 loc) · 2.9 KB
descriptiontitlems.datef1_keywordsms.assetidhelpviewer_keywords
Learn more about: <allocators> macros
<allocators> macros
11/04/2016
allocators/std::ALLOCATOR_DECL
allocators/std::CACHE_CHUNKLIST
allocators/std::CACHE_FREELIST
allocators/std::CACHE_SUBALLOC
allocators/std::SYNC_DEFAULT
9cb5ee07-1ff9-4594-ae32-3c8c6efb511a
std::ALLOCATOR_DECL [C++]
std::CACHE_CHUNKLIST [C++]
std::CACHE_FREELIST [C++]
std::CACHE_SUBALLOC [C++]
std::SYNC_DEFAULT [C++]

<allocators> macros

:::row::: :::column span=""::: ALLOCATOR_DECL
CACHE_CHUNKLIST :::column-end::: :::column span=""::: CACHE_FREELIST :::column-end::: :::column span=""::: CACHE_SUBALLOC :::column-end::: :::column span=""::: SYNC_DEFAULT :::column-end::: :::row-end:::

ALLOCATOR_DECL

Yields an allocator class template.

#defineALLOCATOR_DECL(cache, sync, name) <alloc_template>

Remarks

The macro yields a template definition template <class Type> class name {.....} and a specialization template <> class name<void> {.....} which together define an allocator class template that uses the synchronization filter sync and a cache of type cache.

For compilers that can compile rebind, the resulting template definition looks like this:

structrebind { /* convert a name<Type> to a name<Other> */typedef name<Other> other; };

For compilers that cannot compile rebind the resulting template definition looks like this:

template <classType<classname : public stdext::allocators::allocator_base<Type, sync<stdext::allocators::rts_alloc<cache>>> { public:name() {} template <classOther> name(const name<Other>&) {} template <classOther> name& operator= (const name<Other>&) { return *this; } };

CACHE_CHUNKLIST

Yields stdext::allocators::cache_chunklist<sizeof(Type)>.

#defineCACHE_CHUNKLIST <cache_class>

Remarks

CACHE_FREELIST

Yields stdext::allocators::cache_freelist<sizeof(Type), max>.

#defineCACHE_FREELIST(max) <cache_class>

Remarks

CACHE_SUBALLOC

Yields stdext::allocators::cache_suballoc<sizeof(Type)>.

#defineCACHE_SUBALLOC <cache_class>

Remarks

SYNC_DEFAULT

Yields a synchronization filter.

#defineSYNC_DEFAULT <sync_template>

Remarks

If a compiler supports compiling both single-threaded and multi-threaded applications, for single-threaded applications the macro yields stdext::allocators::sync_none; in all other cases it yields stdext::allocators::sync_shared.

See also

<allocators>

close