|
Boost : |
Subject: Re: [boost] Idea: Boost.Allocator
From: joel falcou (joel.falcou_at_[hidden])
Date: 2010-04-18 03:11:20
Ion Gaztañaga wrote:
> Applying classic memory allocation strategies to C++ containers (v0.1)
> http://www.drivehq.com/web/igaztanaga/allocplus/
I knew your page already as I shamelessly designed my
allocator_with_resize on your experiment ;)
My basic idea was first to design a allocator_facade like
iterator_facade, using CRTP and calls to usr-defined
specific function. I wasn't happy cause it just looked we put a hat on a
hat already, as the facade was merely
forwarding things back and forth.
My second idea was to have a policy driven allocator that use policies
and tag dispatchign to build its inner types
and to forward its member call to free function usign policy and tag to
work. This had the advantage to enable
the building of a lot of allcoator just by combining policies like
having a resizable, aligned allocator with a way to
get the allocated amount of memory by doing somethign like:
allocator_facade<T, settings(resize_, allocated_, aligned_)>
then computing the composite code needed to do that.
Appropriated traits class helps discrimianting variant of
allcoator_facade for SFINAE purpose like:
support_resizing, support_shrink_to_fit, etc...
Special bonus, all allocator methods and meta-functions (I'm looking at
you rebind) could be externalized
such that calling: allocate( my_allocator, n); forward the allocation to
the proper tag dispatched function of my_allocator.
rebind can also become a real MPL compatible meta-function class:
rebind< Allocator, Type>::type
The only remaining unclear parts is how to structurate those around
proper concepts.
-- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk