
I recently had to use Boost Iterator Facade and its relatives and found the idea great. It occured to me whiel lookign at my X different, hand written allocaotrs for various project that maybe such a system for writing std allocator could be great. Buildign a new allcoator will just be impelemnt some allocator_facade<> adn fill some small scale methods. Moreover, it could be the opportunity to add new allocator concept like allocator supporting resize calls, allcoator with state, allcoator with a allocated() method etc... and reality-check them in the boost framework. How does it sounds ? -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35

joel falcou wrote:
I recently had to use Boost Iterator Facade and its relatives and found the idea great. It occured to me whiel lookign at my X different, hand written allocaotrs for various project that maybe such a system for writing std allocator could be great. Buildign a new allcoator will just be impelemnt some allocator_facade<> adn fill some small scale methods.
Moreover, it could be the opportunity to add new allocator concept like allocator supporting resize calls, allcoator with state, allcoator with a allocated() method etc... and reality-check them in the boost framework.
How does it sounds ?
Sounds great! I've had the same experience. Writing an iterator using the iterator facade is fun. You can concentrate on the essentials. Writing an allocator, on the other hand, you write so much additional stuff. I have an allocator that uses mmap for each allocation. The file has little over 100 lines. But only two of them are actually doing something. The rest is just stuff required for stl allocators... So, yeah, an allocator facade would be cool! Regards, Roland

On 17/04/2010 17:48, joel falcou wrote:
How does it sounds ?
For some ideas on new allocator functions, I have written about some experiments here: Applying classic memory allocation strategies to C++ containers (v0.1) http://www.drivehq.com/web/igaztanaga/allocplus/ Best, Ion

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

On 17 April 2010 16:48, joel falcou <joel.falcou@lri.fr> wrote:
Moreover, it could be the opportunity to add new allocator concept like allocator supporting resize calls, allcoator with state, allcoator with a allocated() method etc... and reality-check them in the boost framework.
How does it sounds ?
You probably should look at the C++0x allocators and allocator traits and see if you can build on them. Daniel

Daniel James wrote:
You probably should look at the C++0x allocators and allocator traits and see if you can build on them.
I knew I was missing soemthing bovious. I'll take a look on that. -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
participants (4)
-
Daniel James
-
Ion Gaztañaga
-
joel falcou
-
Roland Bock