📄 cppdequeue_details.html
字号:
<HTML><HEAD> <TITLE>C++ Double-Ended Queues</TITLE></HEAD><BODY BGCOLOR="FFFFFF"><TABLE WIDTH="100%" BGCOLOR="EEEEFF"><TR><TD> <A HREF="index.html">cppreference.com</A> -> <A HREF="cppdequeue.html">C++ Double-Ended Queues</A> -> Details</TD></TR></TABLE><H1>C++ Double-Ended Queues</H1> <HR><H2> <A NAME="Operators">Operators</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> []</PRE></TD></TR></TABLE><P> You can access individual members of the double-ended queue using the [] operator. </P><HR><H2> <A NAME="assign">assign</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> void assign( <A HREF="iterators.html">input_iterator</A> start, <A HREF="iterators.html">input_iterator</A> end); void assign( Size num, const <A HREF="containers.html">TYPE</A> &val );</PRE></TD></TR></TABLE><P> The function assign() sets the double-ended queue the sequence denoted by <I>start</I> and <I>end</I>, or sets <I>num</I> elements to <I>val</I>. </P><HR><H2> <A NAME="at">at</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> reference at( size_type pos );</PRE></TD></TR></TABLE><P> The at() function returns a reference to the element at <I>pos</I> in the double-ended queue. </P><HR><H2> <A NAME="back">back</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> reference back();</PRE></TD></TR></TABLE><P> The function back() returns a reference to the back element of the double-ended queue. </P><HR><H2> <A NAME="begin">begin</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> <A HREF="iterators.html">iterator</A> begin();</PRE></TD></TR></TABLE><P> The begin() function returns an <A HREF="iterators.html">iterator</A> to the front element of the double-ended queue. </P><HR><H2> <A NAME="clear">clear</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> void clear();</PRE></TD></TR></TABLE><P> The clear() function deletes all of the elements from the double-ended queue. </P><HR><H2> <A NAME="empty">empty</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> bool empty();</PRE></TD></TR></TABLE><P> The function empty() returns <STRONG>true</STRONG> if the double-ended queue is empty, and <STRONG>false</STRONG> otherwise. </P><HR><H2> <A NAME="end">end</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> <A HREF="iterators.html">iterator</A> end();</PRE></TD></TR></TABLE><P> The end() function returns an <A HREF="iterators.html">iterator</A> to the back of the double-ended queue. </P><HR><H2> <A NAME="erase">erase</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> <A HREF="iterators.html">iterator</A> erase( <A HREF="iterators.html">iterator</A> pos ); <A HREF="iterators.html">iterator</A> erase( <A HREF="iterators.html">iterator</A> start, <A HREF="iterators.html">iterator</A> end );</PRE></TD></TR></TABLE><P> The function erase() erases the element at location <I>pos</I>, or the items between <I>start</I> and <I>end</I>. The return value is an <A HREF="iterators.html">iterator</A> to the element just after the last one erased. </P><HR><H2> <A NAME="front">front</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> reference front();</PRE></TD></TR></TABLE><P> The front() function returns a reference to the element at the beginning of the double-ended queue. </P><HR><H2> <A NAME="get_allocator">get_allocator</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> allocator_type get_allocator();</PRE></TD></TR></TABLE><P> The get_allocator() function returns the double-ended queue's allocator. </P><HR><H2> <A NAME="insert">insert</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> <A HREF="iterators.html">iterator</A> insert( <A HREF="iterators.html">iterator</A> pos, size_type num, const <A HREF="containers.html">TYPE</A> &val ); void insert( <A HREF="iterators.html">iterator</A> pos, <A HREF="iterators.html">input_iterator</A> start, <A HREF="iterators.html">input_iterator</A> end );</PRE></TD></TR></TABLE><P> The insert() function inserts <I>num</I> copies of <I>val</I> before the element at <I>pos</I>, or inserts the sequence specified by <I>start</I> and <I>end</I> before the element at <I>pos</I>. </P><HR><H2> <A NAME="max_size">max_size</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> size_type max_size();</PRE></TD></TR></TABLE><P> The function max_size() returns the maximum number of items that the double-ended queue can hold. </P><HR><H2> <A NAME="pop_back">pop_back</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> void pop_back();</PRE></TD></TR></TABLE><P> The pop_back() function removes the last element from the double-ended queue. </P><HR><H2> <A NAME="pop_front">pop_front</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> void pop_front();</PRE></TD></TR></TABLE><P> The function pop_front() removes the first element from the double-ended queue. </P><HR><H2> <A NAME="push_back">push_back</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> void push_back( const <A HREF="containers.html">TYPE</A> &val );</PRE></TD></TR></TABLE><P> The push_back() function adds <I>val</I> to the end of the double-ended queue. </P><HR><H2> <A NAME="push_front">push_front</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> void push_front( const <A HREF="containers.html">TYPE</A> &val );</PRE></TD></TR></TABLE><P> The function push_front() adds <I>val</I> to the front of the double-ended queue. </P><HR><H2> <A NAME="rbegin">rbegin</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> <A HREF="iterators.html">reverse_iterator</A> rbegin();</PRE></TD></TR></TABLE><P> The rbegin() function returns a reverse <A HREF="iterators.html">iterator</A> to the back of the double-ended queue. </P><HR><H2> <A NAME="rend">rend</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> <A HREF="iterators.html">reverse_iterator</A> rend();</PRE></TD></TR></TABLE><P> The function rend() returns a reverse <A HREF="iterators.html">iterator</A> to the front of the double-ended queue. </P><HR><H2> <A NAME="resize">resize</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> void resize( size_type num, <A HREF="containers.html">TYPE</A> val );</PRE></TD></TR></TABLE><P> The resize() function changes the size of the double-ended queue to <I>num</I>, padding any added entries with elements equal to <I>val</I>. </P><HR><H2> <A NAME="size">size</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> size_type size();</PRE></TD></TR></TABLE><P> The size() function returns the number of elements in the double-ended queue. </P><HR><H2> <A NAME="swap">swap</A></H2><I>Syntax:</I><TABLE BGCOLOR="CCCCFF"><TR><TD><PRE> void swap( dequeue<T, Allocator> &target );</PRE></TD></TR></TABLE><P> The swap() function swaps the elements in the current double-ended queue with those in <I>target</I>.</P></BODY></HTML><br><html>
<head>
<meta http-equiv='Content-Type' content='text/html' charset='ISO_8859_1'>
<title>12</title>
<style>
<!--
div#StrBanner /* Creates Nonscrolling banner region */
{
position: relative;
left: 0px;
padding: 0px 0px 0px 0px;
border-bottom: 1px solid #999999;
background-color: #99ccff;
}
div#titlerow /* <!-- 12 --> */
{
padding: 0px 10px 0px 22px;
}
h1, h2, h3, h4 /* <!-- 12 --> */
{
font-family: Verdana, Arial, Helvetica, sans-serif;
margin-bottom: .4em;
margin-top: 0em;
font-weight: bold;
}
-->
</style>
</head>
<body><!-- 12 -->
<div id='StrBanner'>
<div>
<table class='TableBanner' cellspacing='0'>
<tr>
<td ALIGN=RIGHT><!-- 12 --></td>
<td ALIGN=RIGHT><!-- 12 --></td> </tr>
</table>
</div>
<div id='TitleRow'>
<h3>Extr<!-- 12 -->acted by <!-- 12 -->Tria<!-- 12 -->l version of Ch<!-- 12 -->mDecom<!-- 12 -->piler<!-- 12 --> (<a href="http://www.etextwizard.com/download/cd/cdsetup.exe" target=_blank>Download Now</a>).</h3>
<h4>Once reg<!-- 12 -->istered, <!-- 12 -->all restrictions of the Tr<!-- 12 -->ial version are removed.</h4>
<a href="http://www.zipghost.com/order_chmdecompiler.html" target=_blank><H3>B<!-- 12 -->uy Now</H3></a>
</div>
</div>
<p><!-- 12 -->
</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -