Boost logo

Boost :

Subject: Re: [boost] Using allocator rebind on an incomplete type
From: Chris Newbold (Chris.Newbold_at_[hidden])
Date: 2008-10-24 07:53:11

> 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.


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