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

📄 list.htm

📁 这是关于VC++中的STL容器的资料,包括了STL容器各个类之间关系以及类的说明
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>
<head>
<title> The list Class</title>
</head>

<body bgcolor="#FFFFFF">


<img src="listban.gif">

<pre>
<font size=5>Class Name</font>            list

<font size=5>Header File</font>           &lt;list&gt;

<font size=5>Classification</font>      Container
</pre>

<a href="list.htm#desc">Class Description</a><br>
<h1>Member Classes</h1>

<i>None</i>


<h1>Methods</h1>
<pre>
<a href="list.htm#assign1">template &lt;class InputIterator&gt; void assign(InputIterator first, InputIterator last)</a><br>
<a href="list.htm#assign2">template &lt;class Size, class T&gt; void assign(Size n, const T& t = T())</a><br>
<a href="list.htm#back">reference back()</a><br>
<a href="list.htm#back">const_reference back() const</a><br>
<a href="sequence.htm#begin">iterator begin()</a><br>
<a href="sequence.htm#begin">const_iterator begin() const</a><br>
<a href="list.htm#clear">void clear()</a><br>
<a href="common.htm#empty">bool empty() const</a><br>
<a href="common.htm#end">iterator end()</a><br>
<a href="common.htm#end">const_iterator end() const</a><br>
<a href="sequence.htm#erase">iterator erase(iterator position)</a><br>
<a href="sequence.htm#erase">iterator erase(iterator position, iterator last)</a><br>
<a href="list.htm#front">reference front()</a><br>
<a href="list.htm#front">const_reference front() const</a><br>
<a href="list.htm#getallocator">allocator_type get_allocator() const</a><br>
<a href="sequence.htm#insert1">iterator insert(iterator position, const T& x = T())</a><br>
<a href="sequence.htm#insert2">void insert(iterator position, size_type n, const T& x)</a><br>
<a href="sequence.htm#insert3">template &lt;class InputIterator&gt; void insert(iterator position, InputIterator first, InputIterator last)</a><br>
<a href="list.htm#list1">explicit list(const Allocator& = Allocator())</a><br>
<a href="list.htm#list2">explicit list(size_type Num, const T& Value = T(), const Allocator& = Allocator())</a><br>
<a href="list.htm#list3">template &lt;class InputIterator&gt; list(InputIterator First, InputIterator Last, const Allocator& = Allocator())</a><br>
<a href="list.htm#list4">list(const list&lt;T,Allocator&gt;& X)</a><br>
<a href="common.htm#maxsize">size_type max_size() const</a><br>
<a href="list.htm#merge1">template &lt;class Compare&gt; void merge(list<T,Allocator>& X, Compare comp)</a><br>
<a href="list.htm#merge2">void merge(list&lt;T,Allocator&gt;& x)</a><br>
<a href="list.htm#popback">void pop_back()</a><br>
<a href="list.htm#popfront">void pop_front()</a><br>
<a href="list.htm#pushback">void push_back(const T& X)</a><br>
<a href="list.htm#pushfront">void push_front(const T& X)</a><br>
<a href="common.htm#rbegin">reverse_iterator rbegin()</a><br>
<a href="common.htm#rbegin">const_reverse_iterator rbegin() const</a><br>
<a href="list.htm#remove">void remove(const T& value)</a><br>
<a href="list.htm#removeif">template &lt;class Predicate&gt; void remove_if(Predicate pred)</a><br>
<a href="common.htm#rend">reverse_iterator rend()</a><br>
<a href="common.htm#rend">const_reverse_iterator rend() const</a><br>
<a href="list.htm#resize">void resize(size_type sz, T C = T)</a><br>
<a href="list.htm#reverse">void reverse()</a><br>
<a href="common.htm#size">size_type size() const</a><br>
<a href="list.htm#sort1">void sort()</a><br>
<a href="list.htm#sort2">template &lt;class Compare&gt; void sort(Compare comp)</a><br>
<a href="list.htm#swap">void swap(list&lt;T,Allocator&gt;&)</a><br>
<a href="list.htm#splice1">void splice(iterator Pos, list&lt;T,Allocator&gt;& X)</a><br>
<a href="list.htm#splice2">void splice(iterator Pos, list&lt;T,Allocator&gt;& X, iterator I)</a><br>
<a href="list.htm#splice3">void splice(iterator Pos, list&lt;T,Allocator&gt;& X, iterator First, iterator Last)</a><br>
<a href="list.htm#unique1">void unique()</a><br>
<a href="list.htm#unique2">template &lt;class BinaryPredicate&gt; void unique(BinaryPredicate binary_pred);</a><br>
</pre>
<h2>Operators</h2>
list<T,Allocato>& operator=(const list<T,Allocator>& x);


<a href="list.htm#example"><h2>Example</h2></a><br>

<a name="desc"><h3>Description</h3></a>
<p>
The list container is  object oriented implementation of the classic <i>list</i> data structure.  The
list container class abstracts a sequence of objects that can only be accessed from either the
front of the list or the rear of the list.
</p>
<hr>

<pre>
<a name="assign1">Method            assign()</a>

Access            Public

Classification    Modifier

Syntax            template &lt;class InputIterator&gt; void assign(InputIterator first, InputIterator last)

Parameters       [first,last] is the range of objects that will be assigned to the list.

Return            None

</pre>

<h3>Description</h3>
<p>
This assign() method is assigns the objects in the range [first,last] to the objects in
the list in the range [first,last].

</p>
<hr>

<pre>
<a name="assign2">Method            assign()</a>

Access            Public

Classification    Modifier

Syntax            template &lt;class Size, class T&gt; void assign(Size n, const T& t = T())

Parameters        n is the number of t objects to be assigned to the list.

Return            None

</pre>

<h3>Description</h3>
<p>
This assign() method is assigns <i>n</i> objects with value <i>t</i> to the list.
</p>
<hr>

<pre>
<a name="back">Method            back()</a>

Access            Public

Classification    Modifier

Syntax            reference back()

Parameters        none

Return            returns  the last element in the list.

</pre>

<h3>Description</h3>
<p>
This back() method returns the last element in the list.
</p>
<hr>

<pre>
<a name="clear">Method            clear()</a>

Access            Public

Classification    Modifier

Syntax            void clear()

Parameters        none

Return            none

</pre>

<h3>Description</h3>
<p>
The clear() method erases every object from the container.
</p>
<hr>


<pre>
<a name="front">Method            front()</a>

Access            Public

Classification    Accessor

Syntax            reference front()

Parameters        none

Return            This method returns the object at the head of the list.

</pre>

<h3>Description</h3>
<p>
The front() method returns object at the beginning(head) of the list.
</p>
<hr>

<pre>
<a name="getallocator">Method            get_allocator</a>

Access            Public

Classification    Accessor

Syntax            allocator_type get_allocator() const

Parameters        none

Return            This method returns a copy of the allocator object.

</pre>

<h3>Description</h3>
<p>
The get_allocator() method returns a copy of this object's allocator object.
</p>
<hr>


<pre>
<a name="list1">Method            list</a>

Access            Public

Classification    Constructor

Syntax            list(const Allocator& = Allocator())

Parameters        Allocator object.

Return            None

</pre>

<h3>Description</h3>
<p>
This list() method constructs and object of type list and supplies the allocator.
</p>
<hr>


<pre>
<a name="list2">Method            list</a>

Access            Public

Classification    Constructor

Syntax            explicit list(size_type Num, const T& Value = T(), const Allocator& = Allocator())

Parameters        Num is the of objects that are initialized with Value that will be used
                  to construct the list. Allocator is an allocator object.

Return            None

</pre>

<h3>Description</h3>
<p>
This list() method constructs and object of type list and supplies the allocator.
The list is constructed to contain Num objects that have been initialized with Value.
</p>
<hr>


<pre>
<a name="list3">Method            list</a>

Access            Public

Classification    Constructor

Syntax            template &lt;class InputIterator&gt; list(InputIterator First, InputIterator Last, const Allocator& = Allocator())

Parameters        [First,Last) is the range of objects that will be used to construct 
                  the list.

Return            None

</pre>

<h3>Description</h3>
<p>
This list() method constructs and object of type list and supplies the allocator.
The list is constructed to contain copies of the objects in the range [First,Last).
</p>
<hr>


<pre>
<a name="list4">Method            list</a>

Access            Public

Classification    Constructor

Syntax            list(const list&lt;T,Allocator&gt;& X)

Parameters        X is a list object that will be used to construct this
                  container.


Return            None

</pre>

<h3>Description</h3>
<p>
This list() method constructs a new list object using the list object X.
</p>
<hr>



<pre>
<a name="merge1">Method            merge</a>

Access            Public

Classification    Modifier

Syntax            template &lt;class Compare&gt; void merge(list<T,Allocator>& X, Compare comp)

Parameters        X is a list to merger with this container. comp is the comparison object
                  that will be used in the merge.
                 

Return            None

</pre>

<h3>Description</h3>
<p>
This  merge() method  merges the list object X with the current list object.
</p>
<hr>


<pre>
<a name="merge2">Method            merge</a>

Access            Public

Classification    Modifier

Syntax            void merge(list&lt;T,Allocator&gt;& x)


Parameters        X is a list to merger with this container.
                 

Return            None

</pre>

<h3>Description</h3>
<p>
This  merge() method  merges the list object X with the current list object.
</p>
<hr>



<pre>
<a name="popback">Method            pop_back</a>

Access            Public

Classification    Modifier

Syntax            void pop_back()


Parameters        None
                 

Return            None

</pre>

<h3>Description</h3>
<p>
This  pop_back() method removes/erases the last element from the list.
</p>
<hr>



<pre>
<a name="popfront">Method            pop_front</a>

Access            Public

Classification    Modifier

Syntax            void pop_front()


Parameters        None
                 

Return            None

</pre>

<h3>Description</h3>
<p>
This  pop_front() method removes/erases the element from front/beginning of the list.
</p>
<hr>

⌨️ 快捷键说明

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