|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-22 10:25:05
From: "Gabriel Dos Reis" <gdr_at_[hidden]>
>
> A remarkable property about std::allocator<T> is that if it optimizes
> for a given T then it is perfectly reasonable to expect
> std::allocator<T>::template rebind<U>::other (for varying U) to
> optimize equally well :-)
The question is not whether I know that std::allocator<T>::template
rebind<U>::other is std::allocator<U> (which I do), but whether
int * p = std::allocator<int>().allocate(1, 0);
std::allocator<int>().deallocate(p, 1);
long * q = std::allocator<long>().allocate(1, 0);
std::allocator<long>().deallocate(q, 1);
void * * r = std::allocator<void *>().allocate(1, 0);
std::allocator<void *>().deallocate(r, 1);
will reuse the same node when sizeof(int) ~= sizeof(long) ~= sizeof(void*),
or it will result in a pessimization compared to plain new (which will reuse
the node if it has a node allocator.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk