📄 reversebidirectionaliterator.html
字号:
<tt>reverse_bidirectional_iterator</tt>
</TD>
<TD VAlign=top>
See below.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>Reference operator*() const</tt>
</TD>
<TD VAlign=top>
<A href="trivial.html">Trivial Iterator</A>
</TD>
<TD VAlign=top>
The dereference operator
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_bidirectional_iterator& operator++()</tt>
</TD>
<TD VAlign=top>
<A href="ForwardIterator.html">Forward Iterator</A>
</TD>
<TD VAlign=top>
Preincrement
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_bidirectional_iterator operator++(int)</tt>
</TD>
<TD VAlign=top>
<A href="ForwardIterator.html">Forward Iterator</A>
</TD>
<TD VAlign=top>
Postincrement
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_bidirectional_iterator& operator--()</tt>
</TD>
<TD VAlign=top>
<A href="BidirectionalIterator.html">Bidirectional Iterator</A>
</TD>
<TD VAlign=top>
Predecrement
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_bidirectional_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>bool operator==(const reverse_bidirectional_iterator&, const reverse_bidirectional_iterator&)</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>bidirectional_iterator_tag iterator_category(const reverse_bidirectional_iterator&)</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_bidirectional_iterator&)</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_bidirectional_iterator&)</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="BidirectionalIterator.html">Bidirectional Iterator</A> requirements,
but are specific to <tt>reverse_bidirectional_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_bidirectional_iterator<<A href="BidirectionalIterator.html">BidirectionalIterator</A>, T, Reference,
Distance></tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt><A href="BidirectionalIterator.html">BidirectionalIterator</A> base()</tt>
</TD>
<TD VAlign=top>
Returns the current value of the <tt>reverse_bidirectional_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_bidirectional_iterator(i).base() == i</tt> and <tt>&*ri == &*(ri.base() - 1)</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reverse_bidirectional_iterator(<A href="BidirectionalIterator.html">BidirectionalIterator</A> i)</tt>
</TD>
<TD VAlign=top>
Constructs a <tt>reverse_bidirectional_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_bidirectional_iterator</tt>. <tt><A href="List.html">List</A></tt> is a
<A href="ReversibleContainer.html">Reversible Container</A>, so it provides a typedef for the appropriate
instantiation of <tt>reverse_bidirectional_iterator</tt>. The usual way of
declaring these variables is much simpler:
<pre>
list<T>::reverse_bidirectional_iterator rfirst = rbegin();
list<T>::reverse_bidirectional_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_bidirectional_iterator<...> 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>&*(reverse_bidirectional_iterator(i)) == &*(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_bidirectional_iterator(l), reverse_bidirectional_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="ReverseIterator.html" tppabs="http://www.sgi.com/Technology/STL/ReverseIterator.shtml">reverse_iterator</A>,
<A href="BidirectionalIterator.html">Bidirectional Iterator</A>, <A href="iterator_tags.html" tppabs="http://www.sgi.com/Technology/STL/iterator_tags.shtml">iterator tags</A>, <A href="Iterators.html" tppabs="http://www.sgi.com/Technology/STL/Iterators.shtml">Iterator overview</A>
<HR SIZE="6"> <FONT SIZE="-2"> Copyright © 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>© Copyright 1997-1998 CodeGuru</FONT> </CENTER>
</TD>
<TD WIDTH="34%">
<DIV ALIGN=right><FONT SIZE=-1>Contact : <A HREF="mailto:webmaster@codeguru.com">webmaster@codeguru.com</A> </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=NupavNFCY34AAHgkdrY">
<img src="http://ad.doubleclick.net/ad/www.codeguru.com/cpp;ord=NupavNFCY34AAHgkdrY"></a>
</p>
</noscript>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -