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

📄 iterator.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<H2><A NAME="ostreambuf_iterator"><CODE>ostreambuf_iterator</CODE></A></H2><PRE>template&lt;class Elem, class Tr = char_traits&lt;Elem&gt; &gt;    class <B>ostreambuf_iterator</B>        : public iterator&lt;output_iterator_tag,            void, void, void, void&gt; {public:    typedef Elem <B><A HREF="#ostreambuf_iterator::char_type">char_type</A></B>;    typedef Tr <B><A HREF="#ostreambuf_iterator::traits_type">traits_type</A></B>;    typedef basic_streambuf&lt;Elem, Tr&gt; <B><A HREF="#ostreambuf_iterator::streambuf_type">streambuf_type</A></B>;    typedef basic_ostream&lt;Elem, Tr&gt; <B><A HREF="#ostreambuf_iterator::ostream_type">ostream_type</A></B>;    <B><A HREF="#ostreambuf_iterator::ostreambuf_iterator">ostreambuf_iterator</A></B>(streambuf_type *stebuf) throw();    <B><A HREF="#ostreambuf_iterator::ostreambuf_iterator">ostreambuf_iterator</A></B>(ostream_type&amp; ostr) throw();    ostreambuf_iterator&amp; <B><A HREF="#ostreambuf_iterator::operator=">operator=</A></B>(Elem ch);    ostreambuf_iterator&amp; <B><A HREF="#ostreambuf_iterator::operator*">operator*</A></B>();    ostreambuf_iterator&amp; <B><A HREF="#ostreambuf_iterator::operator++">operator++</A></B>();    T1 <B><A HREF="#ostreambuf_iterator::operator++">operator++</A></B>(int);    bool <B><A HREF="#ostreambuf_iterator::failed">failed</A></B>() const throw();    };</PRE><P>The template class describes an output iterator object.It inserts elements of class <B><CODE>Elem</CODE></B>into an <B>output stream buffer</B>,which it accesses via an object it stores,of type pointer to<CODE>basic_streambuf&lt;Elem, Tr&gt;</CODE>.</P><H3><A NAME="ostreambuf_iterator::char_type"><CODE>ostreambuf_iterator::char_type</CODE></A></H3><PRE>typedef Elem <B>char_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>Elem</CODE>.</P><H3><A NAME="ostreambuf_iterator::failed"><CODE>ostreambuf_iterator::failed</CODE></A></H3><PRE>bool <B>failed</B>() const throw();</PRE><P>The member function returns true only if an insertion into theoutput stream buffer has earlier failed.</P><H3><A NAME="ostreambuf_iterator::operator*"><CODE>ostreambuf_iterator::operator*</CODE></A></H3><PRE>ostreambuf_iterator&amp; <B>operator*</B>();</PRE><P>The operator returns <CODE>*this</CODE>.</P><H3><A NAME="ostreambuf_iterator::operator++"><CODE>ostreambuf_iterator::operator++</CODE></A></H3><PRE>ostreambuf_iterator&amp; <B>operator++</B>();T1 <B>operator++</B>(int);</PRE><P>The first operator returns <CODE>*this</CODE>. The second operatorreturns an object of some type <CODE>T1</CODE> that can be converted to<CODE>ostreambuf_iterator&lt;Elem, Tr&gt;</CODE>.</P><H3><A NAME="ostreambuf_iterator::operator="><CODE>ostreambuf_iterator::operator=</CODE></A></H3><PRE>ostreambuf_iterator&amp; <B>operator=</B>(Elem ch);</PRE><P>The operator inserts <CODE>ch</CODE> into the associated stream buffer,then returns <CODE>*this</CODE>.</P><H3><A NAME="ostreambuf_iterator::ostream_type"><CODE>ostreambuf_iterator::ostream_type</CODE></A></H3><PRE>typedef basic_ostream&lt;Elem, Tr&gt; <B>ostream_type</B>;</PRE><P>The type is a synonym for<CODE>basic_ostream&lt;Elem,Tr&gt;</CODE>.</P><H3><A NAME="ostreambuf_iterator::ostreambuf_iterator"><CODE>ostreambuf_iterator::ostreambuf_iterator</CODE></A></H3><PRE><B>ostreambuf_iterator</B>(streambuf_type *strbuf) throw();<B>ostreambuf_iterator</B>(ostream_type&amp; ostr) throw();</PRE><P>The first constructor initializes the output stream-buffer pointerwith <CODE>strbuf</CODE>.The second constructor initializes the output stream-buffer pointer with<CODE>ostr.rdbuf()</CODE>.(The stored pointer must not be a null pointer.)</P><H3><A NAME="ostreambuf_iterator::streambuf_type"><CODE>ostreambuf_iterator::streambuf_type</CODE></A></H3><PRE>typedef basic_streambuf&lt;Elem, Tr&gt; <B>streambuf_type</B>;</PRE><P>The type is a synonym for <CODE>basic_streambuf&lt;Elem, Tr&gt;</CODE>.</P><H3><A NAME="ostreambuf_iterator::traits_type"><CODE>ostreambuf_iterator::traits_type</CODE></A></H3><PRE>typedef Tr <B>traits_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>Tr</CODE>.</P><H2><A NAME="output_iterator_tag"><CODE>output_iterator_tag</CODE></A></H2><PRE>struct <B>output_iterator_tag</B> {    };</PRE><P>The type is the same as<CODE>iterator&lt;Iter&gt;::<A HREF="#iterator::iterator_category">iterator_category</A></CODE>when <CODE>Iter</CODE> describes an object that can serve as aoutput iterator.</P><H2><A NAME="random_access_iterator_tag"><CODE>random_access_iterator_tag</CODE></A></H2><PRE>struct <B>random_access_iterator_tag</B>    : public bidirectional_iterator_tag {    };</PRE><P>The type is the same as<CODE>iterator&lt;Iter&gt;::<A HREF="#iterator::iterator_category">iterator_category</A></CODE>when <CODE>Iter</CODE> describes an object that can serve as arandom-access iterator.</P><H2><A NAME="reverse_iterator"><CODE>reverse_iterator</CODE></A></H2><PRE>template&lt;class RanIt&gt;    class <B>reverse_iterator</B> : public iterator&lt;        typename iterator_traits&lt;RanIt&gt;::iterator_category,        typename iterator_traits&lt;RanIt&gt;::value_type,        typename iterator_traits&lt;RanIt&gt;::difference_type,        typename iterator_traits&lt;RanIt&gt;::pointer,        typename iterator_traits&lt;RanIt&gt;::reference&gt; {    typedef typename iterator_traits&lt;RanIt&gt;::difference_type        <B><A HREF="#reverse_iterator::difference_type">difference_type</A></B>;    typedef typename iterator_traits&lt;RanIt&gt;::pointer        <B><A HREF="#reverse_iterator::pointer">pointer</A></B>;    typedef typename iterator_traits&lt;RanIt&gt;::reference        <B><A HREF="#reverse_iterator::reference">reference</A></B>;public:    typedef RanIt <B><A HREF="#reverse_iterator::iterator_type">iterator_type</A></B>;    <B><A HREF="#reverse_iterator::reverse_iterator">reverse_iterator</A></B>();    explicit <B><A HREF="#reverse_iterator::reverse_iterator">reverse_iterator</A></B>(RanIt right);    template&lt;class Ty&gt;        <B><A HREF="#reverse_iterator::reverse_iterator">reverse_iterator</A></B>(const reverse_iterator&lt;Ty&gt;&amp; right);    RanIt <B><A HREF="#reverse_iterator::base">base</A></B>() const;    reference <B><A HREF="#reverse_iterator::operator*">operator*</A></B>() const;    pointer <B><A HREF="#reverse_iterator::operator-&gt;">operator-&gt;</A></B>() const;    reverse_iterator&amp; <B><A HREF="#reverse_iterator::operator++">operator++</A></B>();    reverse_iterator <B><A HREF="#reverse_iterator::operator++">operator++</A></B>(int);    reverse_iterator&amp; <B><A HREF="#reverse_iterator::operator--">operator--</A></B>();    reverse_iterator <B><A HREF="#reverse_iterator::operator--">operator--</A></B>();    reverse_iterator&amp; <B><A HREF="#reverse_iterator::operator+=">operator+=</A></B>(difference_type off);    reverse_iterator <B><A HREF="#reverse_iterator::operator+">operator+</A></B>(difference_type off) const;    reverse_iterator&amp; <B><A HREF="#reverse_iterator::operator-=">operator-=</A></B>(difference_type off);    reverse_iterator <B><A HREF="#reverse_iterator::operator-">operator-</A></B>(difference_type off) const;    reference <B><A HREF="#reverse_iterator::operator[]">operator[]</A></B>(difference_type off) const;protected:    RanIt <B>current</B>;    };</PRE><P>The template class describes an object that behaves like arandom-access iterator, only in reverse. It stores a random-access iteratorof type <B><CODE>RanIt</CODE></B> in the protected object<B><CODE><A NAME="reverse_iterator::current">current</A></CODE></B>.Incrementing the object <CODE>X</CODE> of type<CODE>reverse_iterator</CODE>decrements <CODE>X.current</CODE>, and decrementing <CODE>x</CODE>increments <CODE>X.current</CODE>.Moreover, the expression <CODE>*X</CODE> evaluates to<CODE>*(current - 1)</CODE>,of type <B><CODE>reference</CODE></B>. Typically, <CODE>reference</CODE> istype <CODE>Tr&amp;</CODE>.</P><P>Thus, you can use an object of class<CODE>reverse_iterator</CODE> to access in reverseorder a sequence that is traversed in order by a random-accessiterator.</P><P>Several STL <A HREF="lib_cont.html#Containers">containers</A> specialize<CODE>reverse_iterator</CODE> for <CODE>RanIt</CODE> a bidirectional iterator.In these cases, you must not call any of the member functions <CODE>operator+=</CODE>,<CODE>operator+</CODE>, <CODE>operator-=</CODE>, <CODE>operator-</CODE>, or<CODE>operator[]</CODE>.</P><H3><A NAME="reverse_iterator::base"><CODE>reverse_iterator::base</CODE></A></H3><PRE>RanIt <B>base</B>() const;</PRE><P>The member function returns<CODE><A HREF="#reverse_iterator::current">current</A></CODE>.</P><H3><A NAME="reverse_iterator::difference_type"><CODE>reverse_iterator::difference_type</CODE></A></H3><PRE>typedef typename iterator_traits&lt;RanIt&gt;::difference_type    <B>difference_type</B>;</PRE><P>The type is a synonym for the iterator trait<CODE>typename iterator_traits&lt;RanIt&gt;::pointer</CODE>.</P><H3><A NAME="reverse_iterator::iterator_type"><CODE>reverse_iterator::iterator_type</CODE></A></H3><PRE>typedef RanIt <B>iterator_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>RanIt</CODE>.</P><H3><A NAME="reverse_iterator::operator*"><CODE>reverse_iterator::operator*</CODE></A></H3><PRE>reference <B>operator*</B>() const;</PRE><P>The operator returns<CODE>*(<A HREF="#reverse_iterator::current">current</A> - 1)</CODE>.</P><H3><A NAME="reverse_iterator::operator+"><CODE>reverse_iterator::operator+</CODE></A></H3><PRE>reverse_iterator <B>operator+</B>(difference_type off) const;</PRE><P>The operator returns <CODE>reverse_iterator(*this) += off</CODE>.</P><H3><A NAME="reverse_iterator::operator++"><CODE>reverse_iterator::operator++</CODE></A></H3><PRE>reverse_iterator&amp; <B>operator++</B>();reverse_iterator <B>operator++</B>(int);</PRE><P>The first (preincrement) operator evaluates<CODE>--<A HREF="#reverse_iterator::current">current</A></CODE>.then returns <CODE>*this</CODE>.</P><P>The second (postincrement) operator makes a copy of <CODE>*this</CODE>,evaluates <CODE>--current</CODE>, then returns the copy.</P><H3><A NAME="reverse_iterator::operator+="><CODE>reverse_iterator::operator+=</CODE></A></H3><PRE>reverse_iterator&amp; <B>operator+=</B>(difference_type off);</PRE><P>The operator evaluates<CODE><A HREF="#reverse_iterator::current">current</A> - off</CODE>.then returns <CODE>*this</CODE>.</P><H3><A NAME="reverse_iterator::operator-"><CODE>reverse_iterator::operator-</CODE></A></H3><PRE>reverse_iterator <B>operator-</B>(difference_type off) const;</PRE><P>The operator returns <CODE>reverse_iterator(*this) -= off</CODE>.</P><H3><A NAME="reverse_iterator::operator--"><CODE>reverse_iterator::operator--</CODE></A></H3><PRE>reverse_iterator&amp; <B>operator--</B>();reverse_iterator <B>operator--</B>();</PRE><P>The first (predecrement) operator evaluates<CODE>++<A HREF="#reverse_iterator::current">current</A></CODE>.then returns <CODE>*this</CODE>.</P><P>The second (postdecrement) operator makes a copy of <CODE>*this</CODE>,evaluates <CODE>++current</CODE>, then returns the copy.</P><H3><A NAME="reverse_iterator::operator-="><CODE>reverse_iterator::operator-=</CODE></A></H3><PRE>reverse_iterator&amp; <B>operator-=</B>(difference_type off);</PRE><P>The operator evaluates<CODE><A HREF="#reverse_iterator::current">current</A> + off</CODE>.then returns <CODE>*this</CODE>.</P><H3><A NAME="reverse_iterator::operator-&gt;"><CODE>reverse_iterator::operator-&gt;</CODE></A></H3><PRE>pointer <B>operator-&gt;</B>() const;</PRE><P>The operator returns <CODE>&amp;**this</CODE>.</P><H3><A NAME="reverse_iterator::operator[]"><CODE>reverse_iterator::operator[]</CODE></A></H3><PRE>reference <B>operator[]</B>(difference_type off) const;</PRE><P>The operator returns <CODE>*(*this + off)</CODE>.</P><H3><A NAME="reverse_iterator::pointer"><CODE>reverse_iterator::pointer</CODE></A></H3><PRE>typedef typename iterator_traits&lt;RanIt&gt;::pointer    <B>pointer</B>;</PRE><P>The type is a synonym for the iterator trait<CODE>typename iterator_traits&lt;RanIt&gt;::pointer</CODE>.</P><H3><A NAME="reverse_iterator::reference"><CODE>reverse_iterator::reference</CODE></A></H3><PRE>typedef typename iterator_traits&lt;RanIt&gt;::reference    <B>reference</B>;</PRE><P>The type is a synonym for the iterator trait<CODE>typename iterator_traits&lt;RanIt&gt;::reference</CODE>.</P><H3><A NAME="reverse_iterator::reverse_iterator"><CODE>reverse_iterator::reverse_iterator</CODE></A></H3><PRE><B>reverse_iterator</B>();explicit <B>reverse_iterator</B>(RanIt right);template&lt;class Ty&gt;    <B><A HREF="#reverse_iterator::reverse_iterator">reverse_iterator</A></B>(const reverse_iterator&lt;Ty&gt;&amp; right);</PRE><P>The first constructor initializes<CODE><A HREF="#reverse_iterator::current">current</A></CODE>with its default constructor. The second constructor initializes<CODE>current</CODE> with<CODE>right.<A HREF="#reverse_iterator::current">current</A></CODE>.</P><P>The template constructor initializes <CODE>current</CODE>with <CODE>right.<A HREF="#reverse_iterator::base">base</A>()</CODE>.</P><HR><P>See also the<B><A HREF="index.html#Table of Contents">Table of Contents</A></B> and the<B><A HREF="_index.html">Index</A></B>.</P><P><I><A HREF="crit_pjp.html">Copyright</A> &#169; 1994-2002by P.J. Plauger. Portions derived from work<A HREF="crit_hp.html">copyright</A> &#169; 1994by Hewlett-Packard Company. All rights reserved.</I></P><!--V4.01:1125--></BODY></HTML>

⌨️ 快捷键说明

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