Boost logo

Boost :

From: joaquin_at_[hidden]
Date: 2008-06-06 09:59:25


Armin escribió:
> Hello,
>
> excuse me, I am not sure whether this hasn't already been discussed or
> noted elsewhere, but aren't the allocator classes "pool_allocator<T,..>"
> and "fast_pool_allocator<T,..>" missing a template specialisation for
> T=void?
>
> In section 20.4.1 [lib.default.allocator] of the C++ standard 1998 the
> following specialisation is defined for class std::allocator:
>
> <code>
> template <class T> class allocator;
> // specialize for void:
> template <> class allocator<void> {
> public:
> typedef void* pointer;
> typedef const void* const_pointer;
> // reference-to-void members are impossible.
> typedef void value_type;
> template <class U> struct rebind { typedef allocator<U> other; };
> };
> </code>
>
> The library boost::multi_index, e.g., currently uses the
> std::allocator<void> notation.
>
> In order to use the pool allocators with multi_index_container I would
> suggest the following additions (or something similar) to pool_alloc.hpp:
>
[...]

Hello Armin,

The issue you describe was discussed some weeks ago, precisely in connection
with the use of allocator<void> in Boost.MultiIndex:

http://lists.boost.org/Archives/boost/2008/04/135444.php

I was studying this with the intention to file a bug report against
Boost.Pool, but
after rereading the standard and doing some consults in the newsgroups, it's
not clear to me whether this can be labeled as a genuine bug: even though
std::allocator is properly specialized for void, allocator requirements
do not
explicitly indicate that this must also be the case for other conformant
allocators.
Consequently, I changed the internals of Boost.MultiIndex so as not
produce allocator<void> instantiations, this will go in Boost 1.36.

Nevertheless, I think your proposed change can be submitted as an
enhancement request. Maybe you could file it as so in the Trac system?

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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