Topic: if( container.have( forward_iterator & reverse_iterator ){


Author: llewelly.at@xmission.dot.com (llewelly)
Date: Fri, 14 May 2004 00:07:57 +0000 (UTC)
Raw View
I@ddmrm.com ("DEX") writes:

> English version.
>
> If container has forward and reverse iterator does it mean that container
> must have bi-directional iterator.
>
> Example:
>  1. std::vector have forward, reverse and bidirectional.
>  2. std::list have forward, reverse and bidirectional.

Maybe you want 24.4.1/1, which begins:
[snip]

    # Bidirectional and random access iterators have corresponding
    # reverse iterator adaptors [...]

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: llewelly.at@xmission.dot.com (llewelly)
Date: Mon, 17 May 2004 03:00:37 +0000 (UTC)
Raw View
mail@qWake.com ("qWake") writes:

> "James Kuyper" <kuyper@wizard.net> wrote in message
>
>> As a practical matter, I can't come up with a good reason why anyone
>> would implement a container with both forward and reverse iterators,
>> yet not provide a bidirectional iterator.
>
> To prevent items from being processed more than once?

The value of a forward iterator can be saved, like a bookmark, and
    used to return that spot. So such prevention would have big gaps.

If you *had* a sequence which could be processed in either direction,
    but must only be processed once, you'd better provide two kinds
    of input iterators.


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]