Boost logo

Boost :

Subject: Re: [boost] Proposal: Monotonic Containers - Comparison with boost::pool, boost::fast_pool and TBB
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-06-22 19:25:30


AMDG

Christian Schladetsch wrote:
> https://svn.boost.org/svn/boost/sandbox/monotonic/boost/monotonic/region_allocator.hpp.
> The nterface is:
>
> /// a monotonic region allocator uses a specified storage.
> /// Each region uses independent
> /// storage that may be used and reset.
> template <class T, size_t Region = 0>
> struct region_allocator;
>
> This is used like:
>
> typedef std::list<int, monotonic::region_allocator<int, 0> > List;
> typedef std::list<int, monotonic::region_allocator<int, 42> > OtherList;
> // ....
> monotonic::reset_region<42>();
>
> etc. Basically, it allows you to have up to
> monotonic::DefaultSizes::MaxRegions of independantly controlled regions of
> storage.
>

Why do you need an integer? Can't you use a tag class?
template<class T, class Tag = void>
struct allocator;

typedef std::list<int, monotonic::allocator<int, struct tag1> > List;

In Christ,
Steven Watanabe


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