mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
new file
[SVN r7722]
This commit is contained in:
parent
b70ad177bb
commit
79c360a1d8
92
MultiPassInputIterator.html
Normal file
92
MultiPassInputIterator.html
Normal file
@ -0,0 +1,92 @@
|
||||
<HTML>
|
||||
<!--
|
||||
-- Copyright (c) Jeremy Siek 2000
|
||||
--
|
||||
-- Permission to use, copy, modify, distribute and sell this software
|
||||
-- and its documentation for any purpose is hereby granted without fee,
|
||||
-- provided that the above copyright notice appears in all copies and
|
||||
-- that both that copyright notice and this permission notice appear
|
||||
-- in supporting documentation. Silicon Graphics makes no
|
||||
-- representations about the suitability of this software for any
|
||||
-- purpose. It is provided "as is" without express or implied warranty.
|
||||
-->
|
||||
<Head>
|
||||
<Title>MultiPassInputIterator</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../c++boost.gif"
|
||||
ALT="C++ Boost">
|
||||
|
||||
<BR Clear>
|
||||
|
||||
<H2>
|
||||
<A NAME="concept:MultiPassInputIterator"></A>
|
||||
MultiPassInputIterator
|
||||
</H2>
|
||||
|
||||
This concept is a refinement of <a
|
||||
href="http://www.sgi.com/Technology/STL/InputIterator.html">InputIterator</a>,
|
||||
adding the requirements that the iterator can be used to make multiple
|
||||
passes through a range, and that if <TT>it1 == it2</TT> and
|
||||
<TT>it1</TT> is dereferenceable then <TT>++it1 == ++it2</TT>. The
|
||||
MultiPassInputIterator is very similar to the <a
|
||||
href="http://www.sgi.com/Technology/STL/ForwardIterator.hmtl">ForwardIterator</a>. The
|
||||
only difference is that a <a
|
||||
href="http://www.sgi.com/Technology/STL/ForwardIterator.hmtl">ForwardIterator</a>
|
||||
requires the <TT>reference</TT> type to be <TT>value_type&</TT>, whereas
|
||||
MultiPassInputIterator is like <a
|
||||
href="http://www.sgi.com/Technology/STL/InputIterator.html">InputIterator</a>
|
||||
in that the <TT>reference</TT> type merely has to be convertible to
|
||||
<TT>value_type</TT>.
|
||||
|
||||
|
||||
<h3>Design Notes</h3>
|
||||
|
||||
comments by Valentin Bonnard:
|
||||
|
||||
<p> I think that introducing MultiPassInputIterator isn't the right
|
||||
solution. Do you also want to define MultiPassBidirectionnalIterator
|
||||
and MultiPassRandomAccessIterator ? I don't, definitly. It only
|
||||
confuses the issue. The problem lies into the existing hierarchy of
|
||||
iterators, which mixes movabillity, modifiabillity and lvalue-ness,
|
||||
and these are clearly independant.
|
||||
|
||||
<p> The terms Forward, Bidirectionnal and RandomAccess are about
|
||||
movabillity and shouldn't be used to mean anything else. In a
|
||||
completly orthogonal way, iterators can be immutable, mutable, or
|
||||
neither. Lvalueness of iterators is also orthogonal with
|
||||
immutabillity. With these clean concepts, your MultiPassInputIterator
|
||||
is just called a ForwardIterator.
|
||||
|
||||
<p>
|
||||
Other translations are:<br>
|
||||
std::ForwardIterator -> ForwardIterator & LvalueIterator<br>
|
||||
std::BidirectionnalIterator -> BidirectionnalIterator & LvalueIterator<br>
|
||||
std::RandomAccessIterator -> RandomAccessIterator & LvalueIterator<br>
|
||||
|
||||
<p>
|
||||
Note that in practice the only operation not allowed on my
|
||||
ForwardIterator which is allowed on std::ForwardIterator is
|
||||
<tt>&*it</tt>. I think that <tt>&*</tt> is rarely needed in generic code.
|
||||
|
||||
<p>
|
||||
reply by Jeremy Siek:
|
||||
|
||||
<p>
|
||||
The above analysis by Valentin is right on. Of course, there is
|
||||
the problem with backward compatibility. The current STL implementations
|
||||
are based on the old definition of ForwardIterator. The right course
|
||||
of action is to get ForwardIterator, etc. changed in the C++ standard.
|
||||
Once that is done we can drop MultiPassInputIterator.
|
||||
|
||||
|
||||
<br>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR valign=top>
|
||||
<TD nowrap>Copyright © 2000</TD><TD>
|
||||
<A HREF=http://www.boost.org/people/jeremy_siek.htm>Jeremy Siek</A>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>)
|
||||
</TD></TR></TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
Loading…
x
Reference in New Issue
Block a user