
Daniel James <daniel@calamity.org.uk> writes:
David Abrahams wrote:
*If* you're willing to assume that std::vector<T,A>::iterator is the same type for any A (which is not quite correct in any real implementation because of vector<bool>), you could do this:
I'm pretty sure it would be possible to implement vector<bool>'s so that it could be the same for any A since it's just pointing to raw memory. The iterator only has to different for different allocators when the data it's need to access is dependant on the allocator (such as a node which contains an 'A::pointer'). Or am I missing something?
You're missing something. There's a specialization of vector<bool, allocator<bool> > in the standard whose iterators iterate over bits and use a proxy reference and therefore are not even conforming forward iterators. vector<bool,A> for A != allocator<bool> is still required to have conforming random-access iterators. -- Dave Abrahams Boost Consulting www.boost-consulting.com