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

📄 lis_3222.htm

📁 ARM编辑、编译软件
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<HTML><TITLE>list</TITLE><BODY>
<A HREF="ref.htm"><IMG SRC="images/banner.gif"></A>
<P><STRONG>Click on the banner to return to the Class Reference home page.</STRONG></P>
<P>&copy;Copyright 1996 Rogue Wave Software</P>
<H2>list</H2>
<HR><PRE>     Container</PRE><HR>
<A NAME="Summary"><H3>Summary</H3></A>
<P>A sequence that supports bidirectional iterators</P>
<H3>Contents</H3>
<UL>
<A HREF="#Synopsis"><LI>Synopsis</LI></A>
<A HREF="#Description"><LI>Description</LI></A>
<A HREF="#Interface"><LI>Interface</LI></A>
<A HREF="#Constructors and Destructors"><LI>Constructors and Destructors</LI></A>
<A HREF="#Assignment Operator"><LI>Assignment Operator</LI></A>
<A HREF="#Allocator"><LI>Allocator</LI></A>
<A HREF="#Iterators"><LI>Iterators</LI></A>
<A HREF="#Member Functions"><LI>Member Functions</LI></A>
<A HREF="#Non-member Operators"><LI>Non-member Operators</LI></A>
<A HREF="#Example"><LI>Example</LI></A>
<A HREF="#Warnings"><LI>Warnings</LI></A>
<A HREF="#See Also"><LI>See Also</LI></A>
</UL>
<A NAME="Synopsis"><H3>Synopsis</H3></A>
<PRE>#include &#60;list></PRE>
<PRE>
template &#60;class T, class Allocator = allocator>
class <B>list</B>;
</PRE>
<A NAME="Description"><H3>Description</H3></A>
<P><B><I>list&#60;T,Allocator></B></I> is a type of sequence that  supports bidirectional iterators.  A <B><I>list&#60;T,Allocator></B></I> allows constant time insert and erase operations anywhere within the sequence, with storage management handled automatically. Constant time random access is not supported. </P>
<P>Any type used for the template parameter <SAMP>T</SAMP> must provide  the following (where <SAMP>T</SAMP> is the type, <SAMP>t</SAMP> is a <SAMP>value</SAMP> of <SAMP>T</SAMP> and <SAMP>u</SAMP> is a <SAMP>const</SAMP> <SAMP>value</SAMP> of <SAMP>T</SAMP>): </P>
<PRE>  Default constructor   T()</PRE>
<PRE>  Copy constructors     T(t) and T(u)
  Destructor            t.~T()
  Address of            &#38;t and &#38;u yielding T* and
                         const T* respectively
  Assignment            t = a where a is a
                         (possibly const) value of T</PRE>
<A NAME="Interface"><H3>Interface</H3></A>
<PRE>template &#60;class T, class Allocator = allocator></PRE>
<PRE> class list {
public:
// typedefs
   class iterator;
   class const_iterator;
   typename reference;
   typename const_reference;
   typename size_type;
   typename difference_type;
   typedef T value_type;
   typedef Allocator allocator_type;
   typename reverse_iterator;
   typename const_reverse_iterator;
// Construct/Copy/Destroy
   explicit list (const Allocator&#38; = Allocator());
   explicit list (size_type, const Allocator&#38; = Allocator());
   list (size_type, const T&#38;, const Allocator&#38; = Allocator())
   template &#60;class InputIterator>
   list (InputIterator, InputIterator, 
         const Allocator&#38; = Allocator());
   list(const list&#60;T, Allocator>&#38; x);
   ~list();
   list&#60;T,Allocator>&#38; operator= (const list&#60;T,Allocator>&#38;);
   template &#60;class InputIterator>
    void assign (InputIterator, InputIterator);
   template &#60;class Size, class T>
    void assign (Size n);
   template &#60;class Size, class T>
    void assign (Size n, const T&#38;);
   allocator_type get allocator () const;
// Iterators
   iterator begin ();
   const_iterator begin () const;
   iterator end ();
   const_iterator end () const;
   reverse_iterator rbegin ();
   const_reverse_iterator rbegin () const;
   reverse_iterator rend ();
   const_reverse_iterator rend () const;
// Capacity
   bool empty () const;
   size_type size () const;
   size_type max_size () const;
   void resize (size_type);
   void resize  (size_type, T);
// Element Access
   reference front ();
   const_reference front () const;
   reference back ();
   const_reference back () const;
// Modifiers
   void push_front (const T&#38;);
   void pop_front ();
   void push_back (const T&#38;);
   void pop_back ();
   iterator insert (iterator);
   iterator insert (iterator, const T&#38;);
   void insert (iterator, size_type, const T&#38;);
   template &#60;class InputIterator>
    void insert  (iterator, InputIterator, InputIterator);
   iterator erase (iterator);
   iterator erase (iterator, iterator);
   void swap (list&#60;T, Allocator>&#38;);
   void clear ();
// Special mutative operations on list
   void splice (iterator, list&#60;T, Allocator>&#38;);
   void splice (iterator, list&#60;T, Allocator>&#38;, iterator);
   void splice (iterator, list&#60;T, Allocator>&#38;, iterator, iterator);
   void remove (const T&#38;);
   template &#60;class Predicate>
    void remove_if (Predicate);
   void unique ();
   template &#60;class BinaryPredicate>
    void unique (BinaryPredicate);
   void merge (list&#60;T, Allocator>&#38;);
   template &#60;class Compare>
    void merge (list&#60;T, Allocator>&#38;, Compare);
   void sort ();
   template &#60;class Compare>
    void sort (Compare);
   void reverse();
};
// Non-member List Operators
template &#60;class T>
 bool <B>operator==</B> (const list&#60;T, Allocator>&#38;, 
                  const list&#60;T, Allocator>&#38;);
template &#60;class T>
 bool <B>operator&#60;</B> (const list&#60;T, Allocator>&#38;,
                 const list&#60;T, Allocator>&#38;);
// Specialized Algorithms
template &#60;class T, class Allocator>
void swap (list&#60;T,Allocator>&#38;, list&#60;T, Allocator>&#38;);
</PRE>
<A NAME="Constructors and Destructors"><H3>Constructors and Destructors</H3></A>
<PRE>explicit <B>list </B>(const Allocator&#38; alloc = Allocator());</PRE>
<UL><P>Creates a list of zero elements. The list will use the allocator <SAMP>alloc</SAMP> for all storage management.</P>
</UL>
<PRE>explicit <B>list</B> (size_type n, 
               const Allocator&#38; alloc = Allocator());</PRE>
<UL><P>Creates a list of length <SAMP>n</SAMP>, containing <SAMP>n</SAMP> copies of the default value for type <SAMP>T</SAMP>. Requires that <SAMP>T</SAMP> have a default constructor. The list will use the allocator <SAMP>alloc</SAMP> for all storage management. </P>
</UL>
<PRE><B>list</B> (size_type n, const T&#38; value, 
      const Allocator&#38; alloc = Allocator());</PRE>
<UL><P>Creates a list of length <SAMP>n</SAMP>, containing <SAMP>n</SAMP> copies of <SAMP>value</SAMP>. The list will use the allocator <SAMP>alloc</SAMP> for all storage management. </P>
</UL>
<PRE>template &#60;class InputIterator>
<B>list</B> (InputIterator first, InputIterator last,
      const Allocator&#38; alloc = Allocator()); </PRE>
<UL><P>Creates a list of length <SAMP>last - first</SAMP>, filled with all values obtained by dereferencing the <SAMP>InputIterators</SAMP> on the range<SAMP> [first, last)</SAMP>. The list will use the allocator <SAMP>alloc</SAMP> for all storage management.</P>
</UL>
<PRE><B>list</B> (const list&#60;T, Allocator>&#38; x);</PRE>
<UL><P>Copy constructor.  Creates a copy of <SAMP>x</SAMP>.</P>
</UL>
<PRE><B>~list</B> ();</PRE>
<UL><P>The destructor. Releases any allocated memory for this list.</P>
</UL>
<A NAME="Assignment Operator"><H3>Assignment Operator</H3></A>
<PRE>list&#60;T, Allocator>&#38; <B>operator= </B>(const list&#60;T, Allocator>&#38; x)</PRE>
<UL><P>Erases all elements in self then inserts into self a copy of each element in <SAMP>x</SAMP>.  Returns a reference to <SAMP>*this</SAMP>.</P>
</UL>
<A NAME="Allocator"><H3>Allocator</H3></A>
<PRE>allocator_type <B>get_allocator</B> () const;</PRE>
<UL><P>Returns a copy of the allocator used by self for storage management.</P>
</UL>
<A NAME="Iterators"><H3>Iterators</H3></A>
<PRE>iterator <B>begin</B> ();</PRE>
<UL><P>Returns a bidirectional iterator that points to the first element.</P>
</UL>
<PRE>const_iterator <B>begin</B> () const;</PRE>
<UL><P>Returns a constant bidirectional iterator that points to the first element.</P>
</UL>
<PRE>iterator <B>end</B> ();</PRE>
<UL><P>Returns a bidirectional iterator that points to the past-the-end value.</P>
</UL>
<PRE>const_iterator <B>end</B> () const;</PRE>
<UL><P>Returns a constant bidirectional iterator  that  points to the past-the-end value.</P>
</UL>
<PRE>reverse_iterator <B>rbegin</B> ();</PRE>
<UL><P>Returns a bidirectional iterator that points to the past-the-end value.</P>
</UL>
<PRE>const_reverse_iterator <B>rbegin</B> () const;</PRE>
<UL><P>Returns a constant bidirectional iterator that points to the past-the-end value.</P>
</UL>
<PRE>reverse_iterator <B>rend</B> ();</PRE>
<UL><P>Returns a bidirectional iterator that points to the first element.</P>
</UL>
<PRE>const_reverse_iterator <B>rend</B> () const;</PRE>
<UL><P>Returns a constant bidirectional iterator  that  points to the first element.</P>
</UL>
<A NAME="Member Functions"><H3>Member Functions</H3></A>
<PRE>template &#60;class InputIterator>
void 
<B>assign</B> (InputIterator first, InputIterator last);</PRE>
<UL><P>Erases all elements contained in self, then inserts new elements from the range <SAMP>[first, last)</SAMP>.</P>
</UL>
<PRE>template &#60;class Size, class T>
void 
<B>assign</B> (Size n);</PRE>
<UL><P>Erases all elements contained in self, then inserts <SAMP>n</SAMP> instances of the default <SAMP>value</SAMP> of <SAMP>t.</SAMP></P>
</UL>
<PRE>template &#60;class Size, class T>
void 
<B>assign</B> (Size n, const T&#38; t);</PRE>
<UL><P>Erases all elements contained in self, then inserts <SAMP>n</SAMP> instances of the <SAMP>value</SAMP> of <SAMP>t.</SAMP></P>
</UL>
<PRE>reference 
<B>back</B> ();</PRE>
<UL><P>Returns a <SAMP>reference</SAMP> to the last element.</P>
</UL>
<PRE>const_reference 
<B>back</B> () const;</PRE>
<UL><P>Returns a constant reference to the last element.</P>
</UL>
<PRE>void
<B>clear</B> ();</PRE>
<UL><P>Erases all elements from the list.</P>
</UL>
<PRE>bool 

⌨️ 快捷键说明

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