Boost logo

Boost :

Subject: Re: [boost] Using allocator rebind on an incomplete type
From: Bo Persson (bop_at_[hidden])
Date: 2008-10-25 08:12:41

Chris Newbold wrote:
>> From: boost-bounces_at_[hidden]
>> [mailto:boost-bounces_at_[hidden]] On Behalf Of David Abrahams
>> Sent: Thursday, October 23, 2008 7:16 PM
>> Thus, std::allocator<T>::rebind<X> on an incomplete X induces
>> undefined behavior when a user does it. The library might know
>> enough about std::allocator to do it anyway, though.
> Microsoft's std::list implementation uses rebind on the
> (user-supplied) allocator to get an allocator for its internal
> linked-list node. However, at the time it applies rebind, the
> linked-list node structure is incomplete. In this case they cannot
> assume the allocator is std::allocator-- in effect, they've imposed
> a constraint that user-defined allocators "work" for incomplete
> types.

Yes, but their other choice is to use a Node* as the link between the
list nodes. That imposes a different set of constraints on user
defined allocators.

Which set do we prefer?

Bo Persson

Boost list run by bdawes at, gregod at, cpdaniel at, john at