Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-02-27 10:40:28


Daniel James <daniel_at_[hidden]> 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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk