Boost logo

Boost :

Subject: Re: [boost] Stack-based vector container
From: gast128 (gast128_at_[hidden])
Date: 2011-01-09 17:23:25


I 've noticed this as well. In our application we use a data sample class
which gets created and deleted a lot. It is slow because it uses a
std::map, which is heavy on creation and deletion.

I was thus thinking about making a custom allocator, but item 10 from
Meyers 'Effective STL' talked me out of it, especially stating that portable
allocators should be more or less stateless. The obvious use of an allocator
was to allocate from a special fast (non thread safe) private memory pool.

Btw I was trying the stack_alloc allocator but on VS2003 it fails to compile
for list and set. I think it is related that the list/set implementation which
instantiate it with an incomplete type:

Plauger's list code:

template<class _Ty,
        class _Alloc>
        class _List_nod
        { // base class for _List_ptr to hold allocator _Alnod
protected:
        struct _Node;
        friend struct _Node;
        typedef typename _Alloc::template
                rebind<_GENERIC_BASE>::other::pointer _Genptr;

        etc...
};


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk