 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Prateek R Karandikar Guest
|
Posted: Fri May 21, 2004 9:32 pm Post subject: Why doesn't forward derive from output? |
|
|
TC++PL (18.2):
"A random-access iterator can be used as a bidirectional iterator, a
bidirectional iterator as a forward iterator, and FORWARD iterator as
an input or OUTPUT iterator."
[Capitaliztion is mine]
A forward iterator can be used an an output iterator. Doesn't this
imply that std::forward_iterator_tag sould derive from
std::output_iterator_tag?
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
To iterate is human, to recurse divine.
-L.Peter Deutsch
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
---
[ 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 ]
|
|
| Back to top |
|
 |
P.J. Plauger Guest
|
Posted: Sun May 23, 2004 12:15 am Post subject: Re: Why doesn't forward derive from output? |
|
|
"Prateek R Karandikar" <kprateek88 (AT) yahoo (DOT) com> wrote
| Quote: | TC++PL (18.2):
"A random-access iterator can be used as a bidirectional iterator, a
bidirectional iterator as a forward iterator, and FORWARD iterator as
an input or OUTPUT iterator."
[Capitaliztion is mine]
A forward iterator can be used an an output iterator. Doesn't this
imply that std::forward_iterator_tag sould derive from
std::output_iterator_tag?
|
You'd think that, but actually the hierarchy is used for
dispatching among different algorithms depending on the
"strength" of the required iterator. The most general
algorithm handles the weakest case, and more specialized
versions take advantage of stronger iterators. Since output
iterator is the weakest case, and one that doesn't profit
from optizimation, you never have occasion to dispatch on
an iterator that might be an output iterator. So it need
not appear in the tag hierarchy.
HTH,
P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
---
[ 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 ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|