Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-02-27 18:21:20


Daniel James <daniel_at_[hidden]> writes:

> David Abrahams wrote:
>> 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.
>
> But I don't think that means that you need different iterator types for
> different allocators. The data is still just raw data, an array of (say)
> chars instead of bools.

  std::iterator_traits<std::vector<bool>::iterator>::reference

is different from

  std::iterator_traits<std::vector<bool,A>::iterator>::reference

for all A != std::allocator<bool>

Therefore

  std::vector<bool>::iterator

is different from

  std::vector<bool,A>::iterator

for all A != std::allocator<bool>

QED

-- 
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