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

📄 iterator.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<P>The type is a synonym for<CODE>basic_istream&lt;Elem,Tr&gt;</CODE>.</P><H3><A NAME="istreambuf_iterator::istreambuf_iterator"><CODE>istreambuf_iterator::istreambuf_iterator</CODE></A></H3><PRE><B>istreambuf_iterator</B>(streambuf_type *strbuf = 0) throw();<B>istreambuf_iterator</B>(istream_type&amp; istr) throw();</PRE><P>The first constructor initializes the input stream-buffer pointerwith <CODE>strbuf</CODE>.The second constructor initializes the input stream-buffer pointer with<CODE>istr.rdbuf()</CODE>,then (eventually) attempts to extract and storean object of type <CODE>Elem</CODE>.</P><H3><A NAME="istreambuf_iterator::operator*"><CODE>istreambuf_iterator::operator*</CODE></A></H3><PRE>Elem <B>operator*</B>() const;</PRE><P>The operator returns the stored object of type <CODE>Elem</CODE>.</P><H3><A NAME="istreambuf_iterator::operator++"><CODE>istreambuf_iterator::operator++</CODE></A></H3><PRE>istreambuf_iterator&amp; <B>operator++</B>();istreambuf_iterator <B>operator++</B>(int);</PRE><P>The first operator (eventually) attempts to extract and store an objectof type <CODE>Elem</CODE> from the associated input stream. The secondoperator makes a copy of the object, increments the object, thenreturns the copy.</P><H3><A NAME="istreambuf_iterator::streambuf_type"><CODE>istreambuf_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="istreambuf_iterator::traits_type"><CODE>istreambuf_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="iterator"><CODE>iterator</CODE></A></H2><PRE>template&lt;class Category, class Ty, class Diff = ptrdiff_t    class Pointer = Ty *, class Reference = Ty&amp;&gt;    struct <B>iterator</B> {    typedef Category <B>iterator_category</B>;    typedef Ty <B>value_type</B>;    typedef Diff <B>difference_type</B>;    typedef Pointer <B>pointer</B>;    typedef Reference <B>reference</B>;    };</PRE><P>The template class can serve as a convenient base classfor an iterator class that you define.It defines the member types<CODE><A NAME="iterator::iterator_category">iterator_category</A></CODE>(a synonym for the template parameter <CODE>Category</CODE>),<CODE><A NAME="iterator::value_type">value_type</A></CODE>(a synonym for the template parameter <CODE>Ty</CODE>),<CODE><A NAME="iterator::difference_type">difference_type</A></CODE>(a synonym for the template parameter <CODE>Diff</CODE>),<CODE><A NAME="iterator::pointer">pointer</A></CODE>(a synonym for the template parameter <CODE>Pointer</CODE>), and<CODE><A NAME="iterator::reference">reference</A></CODE>(a synonym for the template parameter <CODE>Reference</CODE>).</P><P>Note that <CODE>value_type</CODE> should <I>not</I> be a constanttype even if <CODE>pointer</CODE> points at an object of const typeand <CODE>reference</CODE> designates an object of const type.</P><H2><A NAME="iterator_traits"><CODE>iterator_traits</CODE></A></H2><PRE>template&lt;class Iter&gt;    struct <B>iterator_traits</B> {    typedef typename Iter::iterator_category <B>iterator_category</B>;    typedef typename Iter::value_type <B>value_type</B>;    typedef typename Iter::difference_type <B>difference_type</B>;    typedef typename Iter::pointer <B>pointer</B>;    typedef typename Iter::reference <B>reference</B>;    };template&lt;class Ty&gt;    struct <B>iterator_traits</B>&lt;Ty *&gt; {    typedef random_access_iterator_tag <B>iterator_category</B>;    typedef Ty <B>value_type</B>;    typedef ptrdiff_t <B>difference_type</B>;    typedef Ty *<B>pointer</B>;    typedef Ty&amp; <B>reference</B>;    };template&lt;class Ty&gt;    struct <B>iterator_traits</B>&lt;const Ty *&gt; {    typedef random_access_iterator_tag <B>iterator_category</B>;    typedef Ty <B>value_type</B>;    typedef ptrdiff_t <B>difference_type</B>;    typedef const Ty *<B>pointer</B>;    typedef const Tr&amp; <B>reference</B>;    };</PRE><P>The template class determines several critical types associatedwith the iterator type <CODE>Iter</CODE>.It defines the member types<CODE><A NAME="iterator_traits::iterator_category">iterator_category</A></CODE>(a synonym for <CODE>Iter::iterator_category</CODE>),<CODE><A NAME="iterator_traits::value_type">value_type</A></CODE>(a synonym for <CODE>Iter::value_type</CODE>),<CODE><A NAME="iterator_traits::difference_type">difference_type</A></CODE>(a synonym for <CODE>Iter::difference_type</CODE>),<CODE><A NAME="iterator_traits::pointer">pointer</A></CODE>(a synonym for <CODE>Iter::pointer</CODE>), and<CODE><A NAME="iterator_traits::reference">reference</A></CODE>(a synonym for <CODE>Iter::reference</CODE>).</P><P>The partial specializations determine the critical types associatedwith an object pointer type <CODE>Ty *</CODE> or <CODE>const Ty *</CODE>. In this<A HREF="index.html#implementation">implementation</A>,you can also use several template functions that do not make use ofpartial specialization:</P><PRE>template&lt;class Category, class Ty, class Diff&gt;    C <B><A NAME="_Iter_cat">_Iter_cat</A></B>(const iterator&lt;Category, Ty, Diff&gt;&amp;);template&lt;class Ty&gt;    random_access_iterator_tag <B>_Iter_cat</B>(const Ty *);template&lt;class Category, class Ty, class Diff&gt;    Ty *<B><A NAME="_Val_type">_Val_type</A></B>(const iterator&lt;Category, Ty, Diff&gt;&amp;);template&lt;class Ty&gt;    Ty *<B>_Val_type</B>(const Ty *);template&lt;class Category, class Ty, class Diff&gt;    Diff *<B><A NAME="_Dist_type">_Dist_type</A></B>(const iterator&lt;Category, Ty, Diff&gt;&amp;);template&lt;class Ty&gt;    ptrdiff_t *<B>_Dist_type</B>(const Ty *);</PRE><P>which determine several of the same types a bit more indirectly.You use these functions as argumentson a function call. Their sole purpose is to supply a useful templateclass parameter to the called function.</P><H2><A NAME="operator!="><CODE>operator!=</CODE></A></H2><PRE>template&lt;class RanIt&gt;    bool <B>operator!=</B>(        const reverse_iterator&lt;RanIt&gt;&amp; left,        const reverse_iterator&lt;RanIt&gt;&amp; right);template&lt;class Ty, class Elem, class Tr, class Diff&gt;    bool <B>operator!=</B>(        const istream_iterator&lt;Ty, Elem, Tr, Diff&gt;&amp; left,        const istream_iterator&lt;Ty, Elem, Tr, Diff&gt;&amp; right);template&lt;class Elem, class Tr&gt;    bool <B>operator!=</B>(        const istreambuf_iterator&lt;Elem, Tr&gt;&amp; left,        const istreambuf_iterator&lt;Elem, Tr&gt;&amp; right);</PRE><P>The template operator returns <CODE>!(left == right)</CODE>.</P><H2><A NAME="operator=="><CODE>operator==</CODE></A></H2><PRE>template&lt;class RanIt&gt;    bool <B>operator==</B>(        const reverse_iterator&lt;RanIt&gt;&amp; left,        const reverse_iterator&lt;RanIt&gt;&amp; right);template&lt;class Ty, class Elem, class Tr, class Diff&gt;    bool <B>operator==</B>(        const istream_iterator&lt;Ty, Elem, Tr, Diff&gt;&amp; left,        const istream_iterator&lt;Ty, Elem, Tr, Diff&gt;&amp; right);template&lt;class Elem, class Tr&gt;    bool <B>operator==</B>(        const istreambuf_iterator&lt;Elem, Tr&gt;&amp; left,        const istreambuf_iterator&lt;Elem, Tr&gt;&amp; right);</PRE><P>The first template operator returns true only if<CODE>left.<A HREF="#reverse_iterator::current">current</A> ==right.current</CODE>. The second template operator returns true onlyif both <CODE>left</CODE> and <CODE>right</CODE> store the samestream pointer. The third template operator returns<CODE>left.<A HREF="#istreambuf_iterator::equal">equal</A>(right)</CODE>.</P><H2><A NAME="operator&lt;"><CODE>operator&lt;</CODE></A></H2><PRE>template&lt;class RanIt&gt;    bool <B>operator&lt;</B>(        const reverse_iterator&lt;RanIt&gt;&amp; left,        const reverse_iterator&lt;RanIt&gt;&amp; right);</PRE><P>The template operator returns<CODE>right.<A HREF="#reverse_iterator::current">current</A> &lt;left.current</CODE> [sic].</P><H2><A NAME="operator&lt;="><CODE>operator&lt;=</CODE></A></H2><PRE>template&lt;class RanIt&gt;    bool <B>operator&lt;=</B>(        const reverse_iterator&lt;RanIt&gt;&amp; left,        const reverse_iterator&lt;RanIt&gt;&amp; right);</PRE><P>The template operator returns <CODE>!(right &lt; left)</CODE>.</P><H2><A NAME="operator&gt;"><CODE>operator&gt;</CODE></A></H2><PRE>template&lt;class RanIt&gt;    bool <B>operator&gt;</B>(        const reverse_iterator&lt;RanIt&gt;&amp; left,        const reverse_iterator&lt;RanIt&gt;&amp; right);</PRE><P>The template operator returns <CODE>right &lt; left</CODE>.</P><H2><A NAME="operator&gt;="><CODE>operator&gt;=</CODE></A></H2><PRE>template&lt;class RanIt&gt;    bool <B>operator&gt;=</B>(        const reverse_iterator&lt;RanIt&gt;&amp; left,        const reverse_iterator&lt;RanIt&gt;&amp; right);</PRE><P>The template operator returns <CODE>!(left &lt; right)</CODE>.</P><H2><A NAME="operator+"><CODE>operator+</CODE></A></H2><PRE>template&lt;class RanIt&gt;    reverse_iterator&lt;RanIt&gt; <B>operator+</B>(Diff off,        const reverse_iterator&lt;RanIt&gt;&amp; right);</PRE><P>The template operator returns <CODE>right + off</CODE>.</P><H2><A NAME="operator-"><CODE>operator-</CODE></A></H2><PRE>template&lt;class RanIt&gt;    Diff <B>operator-</B>(        const reverse_iterator&lt;RanIt&gt;&amp; left,        const reverse_iterator&lt;RanIt&gt;&amp; right);</PRE><P>The template operator returns<CODE>right.<A HREF="#reverse_iterator::current">current</A> -left.current</CODE> [sic].</P><H2><A NAME="ostream_iterator"><CODE>ostream_iterator</CODE></A></H2><PRE>template&lt;class Ty, class Elem = char,    class Tr = char_traits&lt;Elem&gt;  &gt;    class <B>ostream_iterator</B>        : public iterator&lt;output_iterator_tag,            void, void, void, void&gt; {public:    typedef Elem <B><A HREF="#ostream_iterator::char_type">char_type</A></B>;    typedef Tr <B><A HREF="#ostream_iterator::traits_type">traits_type</A></B>;    typedef basic_ostream&lt;Elem, Tr&gt; <B><A HREF="#ostream_iterator::ostream_type">ostream_type</A></B>;    <B><A HREF="#ostream_iterator::ostream_iterator">ostream_iterator</A></B>(ostream_type&amp; ostr);    <B><A HREF="#ostream_iterator::ostream_iterator">ostream_iterator</A></B>(ostream_type&amp; ostr, const Elem *delim);    ostream_iterator&lt;Ty, Elem, Tr&gt;&amp; <B><A HREF="#ostream_iterator::operator=">operator=</A></B>(const Ty&amp; val);    ostream_iterator&lt;Ty, Elem, Tr&gt;&amp; <B><A HREF="#ostream_iterator::operator*">operator*</A></B>();    ostream_iterator&lt;Ty, Elem, Tr&gt;&amp; <B><A HREF="#ostream_iterator::operator++">operator++</A></B>();    ostream_iterator&lt;Ty, Elem, Tr&gt; <B><A HREF="#ostream_iterator::operator++">operator++</A></B>(int);    };</PRE><P>The template class describes an output iterator object.It inserts objects of class <B><CODE>Ty</CODE></B>into an <B>output stream</B>, which it accesses via an object it stores,of type pointer to<CODE>basic_ostream&lt;Elem, Tr&gt;</CODE>.It also stores a pointer to a <B>delimiter string</B>, anull-terminated stringof elements of type <CODE>Elem</CODE>, which is appended aftereach insertion. (Note that the string itself is <I>not</I> copiedby the constructor.</P><H3><A NAME="ostream_iterator::char_type"><CODE>ostream_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="ostream_iterator::operator*"><CODE>ostream_iterator::operator*</CODE></A></H3><PRE>ostream_iterator&lt;Ty, Elem, Tr&gt;&amp; <B>operator*</B>();</PRE><P>The operator returns <CODE>*this</CODE>.</P><H3><A NAME="ostream_iterator::operator++"><CODE>ostream_iterator::operator++</CODE></A></H3><PRE>ostream_iterator&lt;Ty, Elem, Tr&gt;&amp; <B>operator++</B>();ostream_iterator&lt;Ty, Elem, Tr&gt; <B>operator++</B>(int);</PRE><P>The operators both return <CODE>*this</CODE>.</P><H3><A NAME="ostream_iterator::operator="><CODE>ostream_iterator::operator=</CODE></A></H3><PRE>ostream_iterator&lt;Ty, Elem, Tr&gt;&amp; <B>operator=</B>(const Ty&amp; val);</PRE><P>The operator inserts <CODE>val</CODE> into theoutput stream associated with the object,then returns <CODE>*this</CODE>.</P><H3><A NAME="ostream_iterator::ostream_iterator"><CODE>ostream_iterator::ostream_iterator</CODE></A></H3><PRE><B>ostream_iterator</B>(ostream_type&amp; ostr);<B>ostream_iterator</B>(ostream_type&amp; ostr, const Elem *delim);</PRE><P>The first constructor initializes the output stream pointerwith <CODE>&amp;ostr</CODE>. The delimiter string pointer designates anempty string. The second constructor initializes the output streampointer with <CODE>&amp;ostr</CODE> and the delimiter string pointerwith <CODE>delim</CODE>.</P><H3><A NAME="ostream_iterator::ostream_type"><CODE>ostream_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="ostream_iterator::traits_type"><CODE>ostream_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>

⌨️ 快捷键说明

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