<allocators> functions

Visual Studio 2015
 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at <allocators> macros.

ALLOCATOR_DECL](#allocator_decl)|CACHE_CHUNKLIST|CACHE_FREELIST|
|CACHE_SUBALLOC|SYNC_DEFAULT|

Yields an allocator template class.

#define ALLOCATOR_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 template class 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:

struct rebind
   {    /* 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 <class Type<class name
 : public stdext::allocators::allocator_base<Type,
    sync<stdext::allocators::rts_alloc<cache>>>  
{
    public:
 name() {}
    template <class Other>  
name(const name<Other>&) {}
    template <class Other>  
name& operator= (const name<Other>&)
 {return *this; }
 };

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

#define CACHE_CHUNKLIST <cache_class>

Remarks

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

#define CACHE_FREELIST(max) <cache_class>

Remarks

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

#define CACHE_SUBALLOC <cache_class>

Remarks

Yields a synchronization filter.

#define SYNC_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.

<allocators>

Show: