Поделиться через


ALLOCATOR_DECL (<allocators>)

Создает класс шаблонов выделения.

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

Заметки

Макрос создает определение шаблона template <class Type> class name {.....} и специализацию template <> class name<void> {.....}, совместно определяющих класс шаблонов выделения, который использует фильтр синхронизации sync и кэш типа cache.

Для компиляторов, которые могут компилироваться повторно привязать результирующий определение шаблона выглядит следующим образом:

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

Требования

заголовок: <allocators>

Stdext пространство имен:

См. также

Ссылки

<allocators>