This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: iter_swapping vector<bool>::iterator..
On Fri, Mar 18, 2005 at 04:47:23PM +0100, Paolo Carlini wrote:
> Chris Jefferson wrote:
>
> >Vector<bool> isn't a
> >proper container and it's iterators don't satisfy the conditions for
> >forward iterators.
>
> This is not at all *obvious*. I understand what you mean by "isn't a
> proper container",
> this a *well* known issue, in general. The *specific* issue, new to me,
> is that its
> iterators don't satisfy the forward iterator requirements. Therefore, I
> agree that we
> are entitled to not iter_swap those iterators. Still, I'm not sure if
> users understand
> this *long standing* issue with (our implementation) of
> vector<bool>::iterator. Also,
> I'm not sure whether this is actually a bug of our implementation of
> vector<bool>.
c.f. the first paragraph of http://boost.org/libs/iterator/doc/index.html
and Herb Sutter's papers, e.g. http://www.gotw.ca/gotw/050.htm
ForwardIterator requires *p to return T&, notsomething convertible to T.
Would an iter_swap() overload for vector<bool>::iterator be conforming?
Even if not, could you dispatch to a helper function inside iter_swap,
which could be overloaded for vector<bool>::iterator ?
jon