From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2002-09-22 09:57:07
"Peter Dimov" <pdimov_at_[hidden]> writes:
| From: "Gabriel Dos Reis" <gdr_at_[hidden]>
| > "Peter Dimov" <pdimov_at_[hidden]> writes:
| > | > A fairly painless step in that direction would be to use
| > | > std::allocator instead of std::operator new to allocate
| > | > handles.
| > |
| > | I think that it might prove somewhat painful, as shared_ptr allocates
| > | objects of different types (counted_base_impl<P, D>) and a
| > | can only allocate T.
| > I can't follow. typename std::allocator<T>::template rebind<U>::other
| > can allocate U.
| Yes. I don't know how a typical std::allocator would behave, but standard
| containers typically allocate objects of a single type; they rebind once, if
| at all. Would std::allocator<void>::template
| rebind<U>::other().allocate/deallocate (for varying U's) be an optimization?
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 :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk