共用方式為


<allocators> 巨集

ALLOCATOR_DECL

產生配置器類別範本。

#define ALLOCATOR_DECL(cache, sync, name) <alloc_template>

備註

宏會產生範本定義 template <class Type> class name {.....} 和特製化 template <> class name<void> {.....} ,一起定義配置器類別範本,以使用同步處理篩選 sync 和 類型的 cache 快取。

針對可以編譯重新繫結的編譯器,產生的範本定義看起來如下︰

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

針對無法編譯重新繫結的編譯器,產生的範本定義看起來如下︰

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;
    }
};

CACHE_CHUNKLIST

產生 stdext::allocators::cache_chunklist<sizeof(Type)>

#define CACHE_CHUNKLIST <cache_class>

備註

CACHE_FREELIST

產生 stdext::allocators::cache_freelist<sizeof(Type), max>

#define CACHE_FREELIST(max) <cache_class>

備註

CACHE_SUBALLOC

產生 stdext::allocators::cache_suballoc<sizeof(Type)>

#define CACHE_SUBALLOC <cache_class>

備註

SYNC_DEFAULT

產生同步處理篩選。

#define SYNC_DEFAULT <sync_template>

備註

如果編譯器支援編譯單一執行緒和多執行緒應用程式,則針對單一執行緒應用程式,巨集會產生 stdext::allocators::sync_none;在所有其他情況下,則會產生 stdext::allocators::sync_shared

另請參閱

<allocators>