📄 list.html
字号:
this function is constant time. It is permitted to be <i>O(N</i>),
where <i>N</i> is the number of elements in the <tt>list</tt>. If you wish to
test whether a <tt>list</tt> is empty, you should write <tt>L.empty()</tt> rather
than <tt>L.size() == 0</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type max_size() const</tt>
</TD>
<TD VAlign=top>
<A href="Container.html">Container</A>
</TD>
<TD VAlign=top>
Returns the largest possible size of the <tt>list</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>bool empty() const</tt>
</TD>
<TD VAlign=top>
<A href="Container.html">Container</A>
</TD>
<TD VAlign=top>
<tt>true</tt> if the <tt>list</tt>'s size is <tt>0</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>list()</tt>
</TD>
<TD VAlign=top>
<A href="Container.html">Container</A>
</TD>
<TD VAlign=top>
Creates an empty list.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>list(size_type n)</tt>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Creates a list with <tt>n</tt> elements, each of which is a copy of <tt>T()</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>list(size_type n, const T& t)</tt>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Creates a list with <tt>n</tt> copies of <tt>t</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>list(const list&)</tt>
</TD>
<TD VAlign=top>
<A href="Container.html">Container</A>
</TD>
<TD VAlign=top>
The copy constructor.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
template <class <A href="InputIterator.html">InputIterator</A>>
list(InputIterator f, InputIterator l)
<A href="#2">[2]</A>
</pre>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Creates a list with a copy of a range.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>~list()</tt>
</TD>
<TD VAlign=top>
<A href="Container.html">Container</A>
</TD>
<TD VAlign=top>
The destructor.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>list& operator=(const list&)</tt>
</TD>
<TD VAlign=top>
<A href="Container.html">Container</A>
</TD>
<TD VAlign=top>
The assignment operator
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reference front()</tt>
</TD>
<TD VAlign=top>
<A href="FrontInsertionSequence.html">Front Insertion Sequence</A>
</TD>
<TD VAlign=top>
Returns the first element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>const_reference front() const</tt>
</TD>
<TD VAlign=top>
<A href="FrontInsertionSequence.html">Front Insertion Sequence</A>
</TD>
<TD VAlign=top>
Returns the first element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reference back()</tt>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Returns the last element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>const_reference back() const</tt>
</TD>
<TD VAlign=top>
<A href="BackInsertionSequence.html">Back Insertion Sequence</A>
</TD>
<TD VAlign=top>
Returns the last element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void push_front(const T&)</tt>
</TD>
<TD VAlign=top>
<A href="FrontInsertionSequence.html">Front Insertion Sequence</A>
</TD>
<TD VAlign=top>
Inserts a new element at the beginning.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void push_back(const T&)</tt>
</TD>
<TD VAlign=top>
<A href="BackInsertionSequence.html">Back Insertion Sequence</A>
</TD>
<TD VAlign=top>
Inserts a new element at the end.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void pop_front()</tt>
</TD>
<TD VAlign=top>
<A href="FrontInsertionSequence.html">Front Insertion Sequence</A>
</TD>
<TD VAlign=top>
Removes the first element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void pop_back()</tt>
</TD>
<TD VAlign=top>
<A href="BackInsertionSequence.html">Back Insertion Sequence</A>
</TD>
<TD VAlign=top>
Removes the last element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void swap(list&)</tt>
</TD>
<TD VAlign=top>
<A href="Container.html">Container</A>
</TD>
<TD VAlign=top>
Swaps the contents of two lists.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>iterator insert(iterator pos, const T& x)</tt>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Inserts <tt>x</tt> before <tt>pos</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
template <class <A href="InputIterator.html">InputIterator</A>>
void insert(iterator pos,
InputIterator f,
InputIterator l)
<A href="#2">[2]</A>
</pre>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Inserts the range <tt>[f, l)</tt> before <tt>pos</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
void insert(iterator pos,
size_type n, const T& x)
</pre>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Inserts <tt>n</tt> copies of <tt>x</tt> before <tt>pos</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>iterator erase(iterator pos)</tt>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Erases the element at position <tt>pos</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>iterator erase(iterator first, iterator last)</tt>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Erases the range <tt>[first, last)</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void clear()</tt>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Erases all of the elements.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void splice(iterator pos, list& L)</tt>
</TD>
<TD VAlign=top>
<tt>list</tt>
</TD>
<TD VAlign=top>
See below.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
void splice(iterator pos,
list& L,
iterator i)
</pre>
</TD>
<TD VAlign=top>
<tt>list</tt>
</TD>
<TD VAlign=top>
See below.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
void splice(iterator pos,
list& L,
iterator f, iterator l)
</pre>
</TD>
<TD VAlign=top>
<tt>list</tt>
</TD>
<TD VAlign=top>
See below.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void remove(const T& value)</tt>
</TD>
<TD VAlign=top>
<tt>list</tt>
</TD>
<TD VAlign=top>
See below.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void unique()</tt>
</TD>
<TD VAlign=top>
<tt>list</tt>
</TD>
<TD VAlign=top>
See below.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void merge(list& L)</tt>
</TD>
<TD VAlign=top>
<tt>list</tt>
</TD>
<TD VAlign=top>
See below.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void sort()</tt>
</TD>
<TD VAlign=top>
<tt>list</tt>
</TD>
<TD VAlign=top>
See below.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
bool operator==(const list&,
const list&)
</pre>
</TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -