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

📄 vector.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<P>The member function returns a reverse iterator that points justbeyond the end of the controlled sequence. Hence, it designates thebeginning of the reverse sequence.</P><H3><CODE><A NAME="vector::reference">vector::reference</A></CODE></H3><PRE>typedef typename Alloc::reference <B>reference</B>;</PRE><P>The type describes an object that can serve as a reference to anelement of the controlled sequence.</P><H3><CODE><A NAME="vector::rend">vector::rend</A></CODE></H3><PRE>const_reverse_iterator <B>rend</B>() const;reverse_iterator <B>rend</B>();</PRE><P>The member function returns a reverse iterator that points at thefirst element of the sequence (or just beyond the end of an emptysequence). Hence, it designates the end of the reverse sequence.</P><H3><CODE><A NAME="vector::reserve">vector::reserve</A></CODE></H3><PRE>void <B>reserve</B>(size_type count);</PRE><P>If <CODE>count</CODE> is greater than<CODE><A HREF="#vector::max_size">max_size</A>()</CODE>,the member function reports a<B><A NAME="length error">length error</A></B> bythrowing an object of class <CODE>length_error</CODE>.Otherwise, it ensures that<CODE><A HREF="#vector::capacity">capacity</A>()</CODE>henceforth returns at least <CODE>count</CODE>.</P><H3><CODE><A NAME="vector::resize">vector::resize</A></CODE></H3><PRE>void <B>resize</B>(size_type newsize);void <B>resize</B>(size_type newsize, Ty val);</PRE><P>The member functions both ensure that<CODE><A HREF="#vector::size">size</A>()</CODE> henceforthreturns <CODE>newsize</CODE>. If it must make the controlled sequence longer,the first member function appends elements with value <CODE>Ty()</CODE>,while the second member function appends elements with value <CODE>val</CODE>.To make the controlled sequence shorter, both member functions call<CODE><A HREF="#vector::erase">erase</A>(begin() + newsize, end())</CODE>.</P><H3><CODE><A NAME="vector::reverse_iterator">vector::reverse_iterator</A></CODE></H3><PRE>typedef reverse_iterator&lt;iterator&gt;    <B>reverse_iterator</B>;</PRE><P>The type describes an object that can serve as a reverse iteratorfor the controlled sequence.</P><H3><CODE><A NAME="vector::size">vector::size</A></CODE></H3><PRE>size_type <B>size</B>() const;</PRE><P>The member function returns the length of the controlled sequence.</P><H3><CODE><A NAME="vector::size_type">vector::size_type</A></CODE></H3><PRE>typedef T2 <B>size_type</B>;</PRE><P>The unsigned integer type describes an object that can represent thelength of any controlled sequence. It is described here as asynonym for the implementation-defined type <CODE>T2</CODE>.</P><H3><CODE><A NAME="vector::swap">vector::swap</A></CODE></H3><PRE>void <B>swap</B>(vector&amp; right);</PRE><P>The member function swaps the controlled sequences between<CODE>*this</CODE> and <CODE>right</CODE>. If<CODE><A HREF="#vector::get_allocator">get_allocator</A>()== right.get_allocator()</CODE>, it does so in constant time,it throws no exceptions, and it invalidates no references, pointers,or iterators that designate elements in the two controlled sequences.Otherwise, it performs a number of element assignments and constructor callsproportional to the number of elements in the two controlled sequences.</P><H3><CODE><A NAME="vector::value_type">vector::value_type</A></CODE></H3><PRE>typedef typename Alloc::value_type <B>value_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>Ty</CODE>.</P><H3><CODE><A NAME="vector::vector">vector::vector</A></CODE></H3><PRE><B>vector</B>();explicit <B>vector</B>(const Alloc&amp; al);explicit <B>vector</B>(size_type count);<B>vector</B>(size_type count, const Ty&amp; val);<B>vector</B>(size_type count, const Ty&amp; val, const Alloc&amp; al);<B>vector</B>(const vector&amp; right);template&lt;class InIt&gt;    <B>vector</B>(InIt first, InIt last);template&lt;class InIt&gt;    <B>vector</B>(InIt first, InIt last, const Alloc&amp; al);</PRE><P>All constructors store an<A HREF="memory.html#allocator object">allocator object</A> andinitialize the controlled sequence. The allocator object is the argument<CODE>al</CODE>, if present. For the copy constructor, it is<CODE>right.<A HREF="#vector::get_allocator">get_allocator</A>()</CODE>.Otherwise, it is <CODE>Alloc()</CODE>.</P><P>The first two constructors specify anempty initial controlled sequence. The third constructor specifiesa repetition of <CODE>count</CODE> elements of value <CODE>Ty()</CODE>.The fourth and fifth constructors specifya repetition of <CODE>count</CODE> elements of value <CODE>val</CODE>.The sixth constructor specifies a copy of the sequence controlled by<CODE>right</CODE>.If <CODE>InIt</CODE> is an integer type, the last two constructorsspecify a repetition of <CODE>(size_type)first</CODE> elements of value<CODE>(Ty)last</CODE>. Otherwise, thelast two constructors specify the sequence<CODE>[first, last)</CODE>.</P><H2><A NAME="vector&lt;bool&gt;"><CODE>vector&lt;bool,Alloc&gt;</CODE></A></H2><PRE>template&lt;class Alloc&gt;    class vector&lt;bool, Alloc&gt; {public:    class <B><A HREF="#vector&lt;bool&gt;::reference">reference</A></B>;    typedef bool <B><A HREF="#vector&lt;bool&gt;::const_reference">const_reference</A></B>;    typedef T0 <B><A HREF="#vector&lt;bool&gt;::iterator">iterator</A></B>;    typedef T1 <B><A HREF="#vector&lt;bool&gt;::const_iterator">const_iterator</A></B>;    typedef T4 <B><A HREF="#vector&lt;bool&gt;::pointer">pointer</A></B>;    typedef T5 <B><A HREF="#vector&lt;bool&gt;::const_pointer">const_pointer</A></B>;    void <B><A HREF="#vector&lt;bool&gt;::flip">flip</A></B>();    static void <B><A HREF="#vector&lt;bool&gt;::swap">swap</A></B>(reference left, reference right);// rest same as template class vector    };</PRE><P>The class is a partial specialization of template class<CODE><A HREF="#vector">vector</A></CODE> for elements of type<CODE>bool</CODE>. It alters the definition of four membertypes (to optimize the packing and unpacking of elements)and adds two member functions. Its behavior is otherwisethe same as for template class <CODE>vector</CODE>.</P><H3><CODE><A NAME="vector&lt;bool&gt;::const_iterator">vector&lt;bool,Alloc&gt;::const_iterator</A></CODE></H3><PRE>typedef T1 <B>const_iterator</B>;</PRE><P>The type describes an object that can serve as a constantrandom-access iterator for the controlled sequence.It is described here as asynonym for the unspecified type <CODE>T1</CODE>.</P><H3><CODE><A NAME="vector&lt;bool&gt;::const_pointer">vector&lt;bool,Alloc&gt;::const_pointer</A></CODE></H3><PRE>typedef T5 <B>const_pointer</B>;</PRE><P>The type describes an object that can serve as a pointerto a constant element of the controlled sequence. It is described here as asynonym for the unspecified type <CODE>T5</CODE>.</P><H3><CODE><A NAME="vector&lt;bool&gt;::const_reference">vector&lt;bool,Alloc&gt;::const_reference</A></CODE></H3><PRE>typedef bool <B>const_reference</B>;</PRE><P>The type describes an object that can serve as a constant referenceto an element of the controlled sequence, in this case <CODE>bool</CODE>.</P><H3><CODE><A NAME="vector&lt;bool&gt;::flip">vector&lt;bool,Alloc&gt;::flip</A></CODE></H3><PRE>void <B>flip</B>();</PRE><P>The member function inverts the values of all the members of thecontrolled sequence.</P><H3><CODE><A NAME="vector&lt;bool&gt;::iterator">vector&lt;bool,Alloc&gt;::iterator</A></CODE></H3><PRE>typedef T0 <B>iterator</B>;</PRE><P>The type describes an object that can serve as a random-accessiterator for the controlled sequence. It is described here as asynonym for the unspecified type <CODE>T0</CODE>.</P><H3><CODE><A NAME="vector&lt;bool&gt;::pointer">vector&lt;bool,Alloc&gt;::pointer</A></CODE></H3><PRE>typedef T4 <B>pointer</B>;</PRE><P>The type describes an object that can serve as a pointerto an element of the controlled sequence. It is described here as asynonym for the unspecified type <CODE>T4</CODE>.</P><H3><CODE><A NAME="vector&lt;bool&gt;::reference">vector&lt;bool,Alloc&gt;::reference</A></CODE></H3><PRE>class reference {public:    reference&amp; <B>operator=</B>(const reference&amp; right);    reference&amp; <B>operator=</B>(bool val);    void <B>flip</B>();    bool <B>operator~</B>() const;    <B>operator bool</B>() const;    };</PRE><P>The type describes an object that can serve as a reference to anelement of the controlled sequence. Specifically, for two objects<CODE>ref</CODE> and <CODE>ref2</CODE> of class <CODE>reference</CODE>:</P><UL><LI><B><CODE>bool(ref)</CODE></B> yields the value of the elementdesignated by <CODE>ref</CODE></LI><LI><B><CODE>~ref</CODE></B> yields the inverted value of the elementdesignated by <CODE>ref</CODE></LI><LI><B><CODE>ref.flip()</CODE></B> inverts the value designated by <CODE>ref</CODE></LI><LI><B><CODE>ref2 = bool(ref)</CODE></B> and <B><CODE>ref2 = ref</CODE></B>both assign the value of the elementdesignated by <CODE>ref</CODE> to the element designated by <CODE>ref2</CODE></LI></UL><P>It is unspecified how member functions of class<CODE>vector&lt;bool&gt;</CODE> construct objects ofclass <CODE>reference</CODE> that designate elements of a controlledsequence. The default constructor for class <CODE>reference</CODE>generates an object that refers to no such element.</P><H3><CODE><A NAME="vector&lt;bool&gt;::swap">vector&lt;bool,Alloc&gt;::swap</A></CODE></H3><PRE>void <B>swap</B>(reference left, reference right);</PRE><P>The static member function swaps the members of thecontrolled sequences designated by <CODE>left</CODE> and <CODE>right</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 + -