⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reverseiterator.html

📁 指导程序员合理、高效的进行标准模板库编程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<TD VAlign=top>
Predecrement
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_iterator operator--(int)</tt>
</TD>
<TD VAlign=top>
 <A href="BidirectionalIterator.html">Bidirectional Iterator</A>
</TD>
<TD VAlign=top>
Postdecrement
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_iterator operator+(Distance)</tt>
</TD>
<TD VAlign=top>
 <A href="RandomAccessIterator.html">Random Access Iterator</A>
</TD>
<TD VAlign=top>
Iterator addition
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_iterator&amp; operator+=(Distance)</tt>
</TD>
<TD VAlign=top>
 <A href="RandomAccessIterator.html">Random Access Iterator</A>
</TD>
<TD VAlign=top>
Iterator addition
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_iterator operator-(Distance)</tt>
</TD>
<TD VAlign=top>
 <A href="RandomAccessIterator.html">Random Access Iterator</A>
</TD>
<TD VAlign=top>
Iterator subtraction
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_iterator&amp; operator-=(Distance)</tt>
</TD>
<TD VAlign=top>
 <A href="RandomAccessIterator.html">Random Access Iterator</A>
</TD>
<TD VAlign=top>
Iterator subtraction
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>Reference operator[](Distance)</tt>
</TD>
<TD VAlign=top>
 <A href="RandomAccessIterator.html">Random Access Iterator</A>
</TD>
<TD VAlign=top>
Random access to an element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_iterator operator+(Distance, reverse_iterator)</tt>
</TD>
<TD VAlign=top>
 <A href="RandomAccessIterator.html">Random Access Iterator</A>
</TD>
<TD VAlign=top>
Iterator addition.  This is a global function, not a member function.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>Distance operator-(const reverse_iterator&amp;, const reverse_iterator&amp;)</tt>
</TD>
<TD VAlign=top>
 <A href="RandomAccessIterator.html">Random Access Iterator</A>
</TD>
<TD VAlign=top>
Finds the distance between two iterators.
  This is a global function, not a member function.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>bool operator==(const reverse_iterator&amp;, const reverse_iterator&amp;)</tt>
</TD>
<TD VAlign=top>
 <A href="trivial.html">Trivial Iterator</A>
</TD>
<TD VAlign=top>
Compares two iterators for equality.
  This is a global function, not a member function.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>bool operator&lt;(const reverse_iterator&amp;, const reverse_iterator&amp;)</tt>
</TD>
<TD VAlign=top>
 <A href="RandomAccessIterator.html">Random Access Iterator</A>
</TD>
<TD VAlign=top>
Determines whether the first argument precedes the second.
  This is a global function, not a member function.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>random_access_iterator_tag iterator_category(const reverse_iterator&amp;)</tt>
</TD>
<TD VAlign=top>
 <A href="iterator_tags.html">Iterator tags</A>
</TD>
<TD VAlign=top>
Returns the iterator's category.
  This is a global function, not a member function.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>T* value_type(const reverse_iterator&amp;)</tt>
</TD>
<TD VAlign=top>
 <A href="iterator_tags.html">Iterator tags</A>
</TD>
<TD VAlign=top>
Returns the iterator's value type.
  This is a global function, not a member function.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>Distance* distance_type(const reverse_iterator&amp;)</tt>
</TD>
<TD VAlign=top>
 <A href="iterator_tags.html">Iterator tags</A>
</TD>
<TD VAlign=top>
Returns the iterator's distance type.
  This is a global function, not a member function.
</TD>
</tr>
</table>
<h3>New members</h3>
These members are not defined 
in the <A href="RandomAccessIterator.html">Random Access Iterator</A> requirements,
but are specific to <tt>reverse_iterator</tt>.
<Table border>
<TR>
<TH>
Member
</TH>
<TH>
Description
</TH>
</TR>
<TR>
<TD VAlign=top>
<tt>self</tt>
</TD>
<TD VAlign=top>
A typedef for <tt>reverse_iterator&lt;<A href="RandomAccessIterator.html">RandomAccessIterator</A>, T, Reference,
   Distance&gt;</tt>.        
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt><A href="RandomAccessIterator.html">RandomAccessIterator</A> base()</tt>
</TD>
<TD VAlign=top>
Returns the current value of the <tt>reverse_iterator</tt>'s base iterator.
   If <tt>ri</tt> is a reverse iterator and <tt>i</tt> is any iterator, 
   the two fundamental identities of reverse iterators can be
   written as
   <tt>reverse_iterator(i).base() == i</tt> and <tt>&amp;*ri == &amp;*(ri.base() - 1)</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_iterator(<A href="RandomAccessIterator.html">RandomAccessIterator</A> i)</tt>
</TD>
<TD VAlign=top>
Constructs a <tt>reverse_iterator</tt> whose base iterator is <tt>i</tt>.
</TD>
</tr>
</table>
<h3>Notes</h3>
<P><A name="1">[1]</A>
There isn't really any good reason to have two separate classes:
this separation is purely because of a technical limitation in some of
today's C++ compilers.  If the two classes were combined into one, then there
would be no way to declare the return types of the <A href="iterator_tags.html">iterator tag</A>
functions <tt><A href="iterator_category.html">iterator_category</A></tt>, <tt><A href="distance_type.html" tppabs="http://www.sgi.com/Technology/STL/distance_type.shtml">distance_type</A></tt> and
<tt><A href="value_type.html">value_type</A></tt> correctly.  The <i>iterator traits</i>
class solves this problem: it addresses the same issues as the iterator tag
functions, but in a cleaner and more flexible manner.  Iterator
traits, however, rely on <i>partial specialization</i>, and many
C++ compilers do not yet implement partial specialization.
Once compilers that support partial specialization become more common,
these two different reverse iterator classes will be combined into 
a single class.
<P><A name="2">[2]</A>
The declarations for <tt>rfirst</tt> and <tt>rlast</tt> are written in this
clumsy form simply as an illustration of how to declare a
<tt>reverse_iterator</tt>.  <tt><A href="Vector.html">Vector</A></tt> is a <A href="ReversibleContainer.html" tppabs="http://www.sgi.com/Technology/STL/ReversibleContainer.shtml">Reversible Container</A>, so it
provides a typedef for the appropriate instantiation of
<tt>reverse_iterator</tt>.  The usual way of declaring these variables
is much simpler:
<pre>
    vector&lt;T&gt;::reverse_iterator rfirst = rbegin();
    vector&lt;T&gt;::reverse_iterator rlast = rend();
</pre>
<P><A name="3">[3]</A>
Note the implications of this remark.  The variable <tt>rfirst</tt> is
initialized as <tt>reverse_iterator&lt;...&gt; rfirst(V.end());</tt>.  The value
obtained when it is dereferenced, however, is <tt>*(V.end() - 1)</tt>.  This
is a general property: the fundamental identity of reverse iterators
is <tt>&amp;*(reverse_iterator(i)) == &amp;*(i - 1)</tt>.  This code sample shows why
this identity is important: if <tt>[f, l)</tt> is a valid range, then it
allows <tt>[reverse_iterator(l), reverse_iterator(f))</tt> to be a valid
range as well.  Note that the iterator <tt>l</tt> is not part of the range,
but it is required to be dereferenceable or past-the-end.  There is no
requirement that any such iterator precedes <tt>f</tt>.
<h3>See also</h3>
<A href="ReversibleContainer.html">Reversible Container</A>, <A href="ReverseBidirectionalIterator.html" tppabs="http://www.sgi.com/Technology/STL/ReverseBidirectionalIterator.shtml">reverse_bidirectional_iterator</A>,
<A href="RandomAccessIterator.html">Random Access Iterator</A>, <A href="iterator_tags.html" tppabs="http://www.sgi.com/Technology/STL/iterator_tags.shtml">iterator tags</A>,
<A href="Iterators.html">Iterator Overview</A>

<HR SIZE="6"> <FONT SIZE="-2"> Copyright &copy; 1996 Silicon Graphics, Inc.
<HR>
<TABLE BORDER=0 WIDTH="100%" >
<TR>
<TD WIDTH="33%"><FONT SIZE=-1><A HREF="index.html" >
STL</A></FONT></TD>

<TD WIDTH="33%">
<CENTER><FONT SIZE=-2>&copy; Copyright 1997-1998 CodeGuru</FONT>&nbsp;</CENTER>
</TD>

<TD WIDTH="34%">
<DIV ALIGN=right><FONT SIZE=-1>Contact : <A HREF="mailto:webmaster@codeguru.com">webmaster@codeguru.com</A>&nbsp;</FONT></DIV>
</TD>
</TR>
</TABLE>
<SCRIPT LANGUAGE="JavaScript" ><!--
var adurl = "/cgi-bin/doubleclick.cgi?";

if( self.adcategory )
	adurl += adcategory;
else
	adurl += "mfc";

if( self.parent.norefreshad )
	parent.norefreshad = false;
else if( validframes )
	parent.frames['ad'].location = adurl;



if( !validframes && nfrm == -1)
{
	var dclkPage = "www.codeguru.com/";
	if( self.adcategory )
		dclkPage += adcategory;
	else 
		dclkPage += "mfc";
//	var random = Math.random();
	document.write('<nolayer><center>');
	document.write('<iframe src="http://ad.doubleclick.net/adi/' + dclkPage + ';ord='
	 + random + '" width=470 height=62 marginwidth=0 marginheight=0 hspace=0 vspace=0 '
	 + 'frameborder=0 scrolling=no bordercolor="#000000">');
	document.write('<a href="http://ad.doubleclick.net/jump/' + dclkPage + ';ord='
	 + random + '">');
	document.write('<img src="http://ad.doubleclick.net/ad/' + dclkPage + ';ord='
	 + random + '" height=60 width=468>' + '</a>');
	document.write('</iframe>');
	document.write('</center></nolayer>');
	document.write('<layer  src="http://ad.doubleclick.net/adl/' + dclkPage + 
	 ';ord=' + random + '"></layer>');
	document.write('<ilayer visibility=hide width=468 height=83></ilayer>');
}

// -->
</SCRIPT> 
<!-- SCRIPT LANGUAGE="JavaScript" SRC="/global/fscript.js">
//
</SCRIPT --> 

<noscript>
<p align="center">
<a href="http://ad.doubleclick.net/jump/www.codeguru.com/cpp;ord=Nupau9FCY34AAHeaoEA">
<img src="http://ad.doubleclick.net/ad/www.codeguru.com/cpp;ord=Nupau9FCY34AAHeaoEA"></a>
</p>
</noscript>





</BODY>
</HTML>


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -