C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Why doesn't forward derive from output?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Prateek R Karandikar
Guest





PostPosted: Fri May 21, 2004 9:32 pm    Post subject: Why doesn't forward derive from output? Reply with 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?

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





PostPosted: Sun May 23, 2004 12:15 am    Post subject: Re: Why doesn't forward derive from output? Reply with quote



"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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.