
24 Oct
2008
24 Oct
'08
11:53 a.m.
From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] 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. -Chris