Bagikan melalui


<allocators> makro

ALLOCATOR_DECL

Menghasilkan templat kelas alokator.

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

Keterangan

Makro menghasilkan definisi template <class Type> class name {.....} templat dan spesialisasi template <> class name<void> {.....} yang bersama-sama menentukan templat kelas alokator yang menggunakan filter sync sinkronisasi dan cache jenis cache.

Untuk pengkompilasi yang dapat mengkompilasi pengikatan ulang, definisi templat yang dihasilkan terlihat seperti ini:

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

Untuk pengkompilasi yang tidak dapat mengkompilasi ulang definisi templat yang dihasilkan terlihat seperti ini:

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

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

#define CACHE_CHUNKLIST <cache_class>

CACHE_FREELIST

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

#define CACHE_FREELIST(max) <cache_class>

CACHE_SUBALLOC

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

#define CACHE_SUBALLOC <cache_class>

SYNC_DEFAULT

Menghasilkan filter sinkronisasi.

#define SYNC_DEFAULT <sync_template>

Keterangan

Jika kompilator mendukung kompilasi aplikasi berulir tunggal dan multi-utas, untuk aplikasi berulir tunggal yang dihasilkan stdext::allocators::sync_nonemakro ; dalam semua kasus lain, aplikasi tersebut menghasilkan stdext::allocators::sync_shared.

Lihat juga

<alokator>