Partager via


ALLOCATOR_DECL (<allocators>)

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:

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

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

Requirements

Header: <allocators>

Namespace: stdext

See Also

Reference

<allocators>