<html>
<head>
<title>Rvalue Reference Recommendations for Chapter 23</title>
<style>
p {text-align:justify}
li {text-align:justify}
blockquote.note
{
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
}
ins {background-color:#FFFFA0}
del {background-color:#FFFFA0}
</style>
</head>

<body>

<address align=right>
Document number: N1858=05-0118<br>
<br>
<a href="mailto:hinnant@twcny.rr.com">Howard E. Hinnant</a><br>
2005-08-26
</address>
<hr>

<h1 align=center>Rvalue Reference Recommendations for Chapter 23</h1>

<h2>Contents</h2>

<ul>
<li><a href="#Introduction">Introduction</a></li>
<li><a href="#23.1 - Container requirements">23.1 - Container requirements</a></li>
<li>
<a href="#23.2 - Sequences">23.2 - Sequences</a>
	<ul>
	<li>
	<a href="#23.2.1 - Class template deque">23.2.1 - Class template
<tt>deque</tt></a>
		<ul>
		<li><a href="#23.2.1.1 - deque constructors, copy, and assignment">23.2.1.1 - <tt>deque</tt> constructors, copy, and assignment</a></li>
		<li><a href="#23.2.1.2 - deque capacity">23.2.1.2 - <tt>deque</tt> capacity</a></li>
		<li><a href="#23.2.1.3 - deque modifiers">23.2.1.3 - <tt>deque</tt> modifiers</a></li>
		<li><a href="#23.2.1.4 - deque specialized algorithms">23.2.1.4 - <tt>deque</tt> specialized algorithms</a></li>
		</ul>
	</li>
	<li>
	<a href="#23.2.2 - Class template list">23.2.2 - Class template
<tt>list</tt></a>
		<ul>
		<li><a href="#23.2.2.1 - list constructors, copy, and assignment">23.2.2.1 - <tt>list</tt> constructors, copy, and assignment</a></li>
		<li><a href="#23.2.2.2 - list capacity">23.2.2.2 - <tt>list</tt> capacity</a></li>
		<li><a href="#23.2.2.3 - list modifiers">23.2.2.3 - <tt>list</tt> modifiers</a></li>
		<li><a href="#23.2.2.4 - list operations">23.2.2.4 - <tt>list</tt> operations</a></li>
		<li><a href="#23.2.2.5 - list specialized algorithms">23.2.2.5 - <tt>list</tt> specialized algorithms</a></li>
		</ul>
	</li>
	<li>
	<a href="#23.2.3 - Container adaptors">23.2.3 - Container adaptors</a>
		<ul>
		<li><a href="#23.2.3.1 - Class template queue">23.2.3.1 - Class template <tt>queue</tt></a></li>
		<li>
		<a href="#23.2.3.2 - Class template priority_queue">23.2.3.2 - Class template
<tt>priority_queue</tt></a>
			<ul>
			<li><a href="#23.2.3.2.1 - priority_queue constructors">23.2.3.2.1 - <tt>priority_queue</tt> constructors</a></li>
			<li><a href="#23.2.3.2.2 - priority_queue members">23.2.3.2.2 - <tt>priority_queue</tt> members</a></li>
			<li><a href="#23.2.3.2.3 - priority_queue specialized algorithms">23.2.3.2.3 - <tt>priority_queue</tt> specialized algorithms</a></li>
			</ul>
		</li>
		<li><a href="#23.2.3.3 - Class template stack">23.2.3.3 - Class template <tt>stack</tt></a></li>
		</ul>
	</li>
	<li>
	<a href="#23.2.4 - Class template vector">23.2.4 - Class template
<tt>vector</tt></a>
		<ul>
		<li><a href="#23.2.4.1 - vector constructors, copy, and assignment">23.2.4.1 - <tt>vector</tt> constructors, copy, and assignment</a></li>
		<li><a href="#23.2.4.2 - vector capacity">23.2.4.2 - <tt>vector</tt> capacity</a></li>
		<li><a href="#23.2.4.3 - vector modifiers">23.2.4.3 - <tt>vector</tt> modifiers</a></li>
		<li><a href="#23.2.4.4 - vector specialized algorithms">23.2.4.4 - <tt>vector</tt> specialized algorithms</a></li>
		</ul>
	</li>
	<li><a href="#23.2.5 - Class template vector&lt;bool&gt;">23.2.5 - Class template <tt>vector&lt;bool&gt;</tt></a></li>
	</ul>
</li>
<li>
<a href="#23.3 - Associative containers">23.3 - Associative containers</a>
	<ul>
	<li>
	<a href="#23.3.1 - Class template map">23.3.1 - Class template <tt>map</tt></a>
		<ul>
		<li><a href="#23.3.1.1 - map constructors, copy, and assignment">23.3.1.1 - <tt>map</tt> constructors, copy, and assignment</a></li>
		<li><a href="#23.3.1.2 - map element access">23.3.1.2 - <tt>map</tt> element access</a></li>
		<li><a href="#23.3.1.3 - map modifiers">23.3.1.3 - <tt>map</tt> modifiers</a></li>
		<li><a href="#23.3.1.4 - map operations">23.3.1.4 - <tt>map</tt> operations</a></li>
		<li><a href="#23.3.1.5 - map specialized algorithms">23.3.1.5 - <tt>map</tt> specialized algorithms</a></li>
		</ul>
	</li>
	<li>
	<a href="#23.3.2 - Class template multimap">23.3.2 - Class template
<tt>multimap</tt></a>
		<ul>
		<li><a href="#23.3.2.1 - multimap constructors, copy, and assignment">23.3.2.1 - <tt>multimap</tt> constructors, copy, and assignment</a></li>
		<li><a href="#23.3.2.2 - multimap modifiers">23.3.2.2 - <tt>multimap</tt> modifiers</a></li>
		<li><a href="#23.3.2.3 - multimap operations">23.3.2.3 - <tt>multimap</tt> operations</a></li>
		<li><a href="#23.3.2.4 - multimap specialized algorithms">23.3.2.4 - <tt>multimap</tt> specialized algorithms</a></li>
		</ul>
	</li>
	<li>
	<a href="#23.3.3 - Class template set">23.3.3 - Class template <tt>set</tt></a>
		<ul>
		<li><a href="#23.3.3.1 - set constructors, copy, and assignment">23.3.3.1 - <tt>set</tt> constructors, copy, and assignment</a></li>
		<li><a href="#23.3.3.2 - set modifiers">23.3.3.2 - <tt>set</tt> modifiers</a></li>
		<li><a href="#23.3.3.3 - set specialized algorithms">23.3.3.3 - <tt>set</tt> specialized algorithms</a></li>
		</ul>
	</li>
	<li>
	<a href="#23.3.4 - Class template multiset">23.3.4 - Class template
<tt>multiset</tt></a>
		<ul>
		<li><a href="#23.3.4.1 - multiset constructors, copy, and assignment">23.3.4.1 - <tt>multiset</tt> constructors, copy, and assignment</a></li>
		<li><a href="#23.3.4.2 - multiset modifiers">23.3.4.2 - <tt>multiset</tt> modifiers</a></li>
		<li><a href="#23.3.4.3 - multiset specialized algorithms">23.3.4.3 - <tt>multiset</tt> specialized algorithms</a></li>
		</ul>
	</li>
	</ul>
</li>
</ul>

<h2>Related papers</h2>

<p>
<a href="n1856.html">Rvalue Reference Recommendations for Chapter 20</a><br>
<a href="n1857.html">Rvalue Reference Recommendations for Chapter 21</a><br>
<a href="n1859.html">Rvalue Reference Recommendations for Chapter 24</a><br>
<a href="n1860.html">Rvalue Reference Recommendations for Chapter 25</a><br>
<a href="n1861.html">Rvalue Reference Recommendations for Chapter 26</a><br>
<a href="n1862.html">Rvalue Reference Recommendations for Chapter 27</a>
</p>

<h2><a name="Introduction"></a>Introduction</h2>

<p>
This paper recommends proposed wording with respect to the
<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1690.html">rvalue
reference</a> for the
<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1804.pdf">C++0X
working draft</a>.
This paper restricts its scope to Chapter 23 "Containers library" for the
purpose of breaking the library work associated with the rvalue reference up
into manageable chunks. This paper largely follows the lead of
<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1771.html">N1771:
Impact of the rvalue reference on the Standard Library</a>, but adds more detail
as appropriate.
</p>

<p>
With the exception of this introduction, all non-proposed wording will have a
background color and formatting that
</p>
<blockquote class="note">
looks like this, so that motivation and description is more easily distinguished
from proposed wording.
</blockquote>
<p>
In the proposed wording below, text to be inserted is formatted like
<ins>this</ins>, while wording to be deleted is formatted like <del>this</del>.
</p>

<p>
The proposed wording in this paper will give all containers:
</p>

<ul>
<li>A move constructor.</li>
<li>A move assignment operator.</li>
<li>Allow containers to hold movable but non-copyable types.</li>
<li>Allow <tt>swap</tt>ing of containers to work with rvalues.</li>
<li>Vastly accelerated performance of <tt>insert</tt> and <tt>erase</tt>
for non-node-based containers holding types which are expensive to copy
but cheap to move.</li>
<li>The container adaptors have also been given a swap, and move support
as appropriate.</li>
</ul>

<h2><a name="23.1 - Container requirements"></a>23.1 - Container requirements</h2>

<blockquote class="note">
<p>
The changes in this section removes the requirements that the container's
<tt>value_type</tt> be <tt>CopyConstructible</tt> and <tt>CopyAssignable</tt>
(except where noted).  The container's copy constructor and copy assignment
operator are specifically excepted in a blanket statement in paragraph 3. </p>

<p>
Note that this change is in agreement with
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#276">lwg
issue 276</a>
(Assignable requirement for container value type overly strict), but goes much
further.  Only a few members of <tt>deque</tt>, <tt>list</tt> and
<tt>vector</tt> now need the <tt>CopyAssignable</tt> requirement. </p>

<ul>
<li><tt>operator=</tt></li>
<li><tt>assign</tt></li>
<li><tt>insert</tt> (<tt>deque</tt> and <tt>vector</tt> only)</li>
</ul>

<p>
See <a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1771.html">N1771</a>
for a compact synopsis of which container members require
<tt>CopyConstructible</tt> and <tt>CopyAssignable</tt>. </p>

<p>
The <tt>Assignable</tt> requirement has been renamed to <tt>CopyAssignable</tt>
and moved to the requirements section of chapter 20
(<a href="rv_Chap20.html#20.1.6%20-%20Copy%20assignment">20.1.6</a>).
</p>

<p>
The container requirements are updated to reflect that each container must have
a constant complexity move constructor and move assignment operator. </p>

<p>
Paragraph 13 gives a nod towards performance by making clients responsible for
assuring that container member functions taking rvalues aren't referencing
elements of the same container.  For example: </p>

<blockquote><pre>
vector&lt;string&gt; v(10, "a string");
v.insert(v.begin(), move(v.back())); // undefined behavior: violates 23.1p13
</pre></blockquote>

</blockquote>

<p>
-3- The type of objects stored in these components shall meet the requirements
of <del><tt>CopyConstructible</tt> types (20.1.3)</del>
<ins><tt>MoveConstructible</tt> and <tt>MoveAssignable</tt> types. Additionally
for some member functions (as noted below), the types must meet the requirements
of <tt>CopyConstructible</tt> and/or <tt>CopyAssignable</tt> types. The copy
constructor of each container requires the contained element type to be
<tt>CopyConstructible</tt>. The copy assignment operator of each sequence
container requires the contained type to be both <tt>CopyConstructible</tt> and
<tt>CopyAssignable</tt>. The copy assignment operator of each associative
container requires the contained type to be <tt>CopyConstructible</tt></ins>.
</p>

<p><del>
-4- Table 65 defines the <tt>Assignable</tt> requirement. Some containers
require this property of the types to be stored in the container. <tt>T</tt> is
the type used to instantiate the container, <tt>t</tt> is a value of <tt>T</tt>,
and <tt>u</tt> is a value of (possibly const) <tt>T</tt>.
</del></p>

Delete Table 65 (this requirement has been moved to Chapter 20):

<p><center>
<table border="1">
<caption>Table 65: <tt>Assignable</tt> requirements</caption>
<tr><th>expression</th> <th>return type</th> <th>post-condition</th></tr>
<tr><td><tt>t == u</tt></td> <td><tt>T&</tt></td> <td><tt>t</tt>
is equivalent to <tt>u</tt></td></tr>
</table>
</center></p>

<p>
-5- In Tables 66 and 67, <tt>X</tt> denotes a container class containing objects
of type <tt>T</tt>, <tt>a</tt> and <tt>b</tt> denote values of type <tt>X</tt>,
<tt>u</tt> denotes an identifier<ins>,</ins> <del>and</del> <tt>r</tt> denotes
<del>a value of <tt>X&</tt></del> <ins>an lvalue or a const rvalue of type
<tt>X</tt>, and <tt>rv</tt> denotes a non-const rvalue of type <tt>X</tt></ins>.
</p>

<p>
Add two rows to Table 66, Container requirements:
</p>

<p><center>
<table border="1">
<tr><td><tt>X a = rv</tt></td> <td>&nbsp;</td> <td><tt>MoveConstructible</tt></td> <td>Equal to the value of rv before construction</td> <td>constant</td></tr>
<tr><td><tt>a = rv</tt></td> <td><tt>X&amp;</tt></td> <td><tt>MoveAssignable</tt></td> <td><tt>a</tt> is equal to the value of rv before assignment</td> <td>constant</td></tr>
</table>
</center></p>

<p><ins>
-13- Those container member functions with rvalue-reference parameters may
assume that the reference truly refers to an rvalue, and specifically is not a
reference into the same container.
</ins></p>

<h2><a name="23.2 - Sequences"></a>23.2 - Sequences</h2>

<blockquote class="note">
<p>
This section is updated with extra <tt>swap</tt> signatures for each sequence,
and container adaptor.  Also the needless global function signatures for
<tt>vector&lt;bool&gt;</tt> are removed.  This reflects
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#469">lwg
issue 469</a>,
but 469 only addresses the relational operators.  The <tt>swap</tt> overload for
<tt>vector&lt;bool&gt;</tt> is removed by the same rationale. </p>

<p>
The extra swap signatures are to allow clients to swap: </p>

<ul>
<li>an lvalue with an lvalue</li>
<li>an lvalue with an rvalue</li>
<li>an rvalue with an lvalue</li>
</ul>

<p>
but not </p>

<ul>
<li>an rvalue with an rvalue.</li>
</ul>

<p>
This should make it easier to read, write and teach the "shrink to fit with
<tt>swap</tt>" idiom, which up till now can only be coded as: </p>

<blockquote><pre>
vector&lt;A&gt;(a).swap(a);
</pre></blockquote>

<p>
But now can additionally be coded with any of the following expressions: </p>

<blockquote><pre>
swap(vector&lt;A&gt;(a), a);
swap(a, vector&lt;A&gt;(a));
a.swap(vector&lt;A&gt;(a));
</pre></blockquote>

<p>
Note that although the namespace scope <tt>swap</tt> signatures do prohibit
swaping two rvalues, it is still possible to swap two rvalues using the member
<tt>swap</tt> function: </p>

<blockquote><pre>
vector&lt;A&gt;(a).swap(vector&lt;A&gt;());
</pre></blockquote>

<p>
Such code will probably not appear accidently and so this author does not
believe that this is problematic.  However
<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1784.htm">N1784</a>
does offer a way to solve this problem if it is deemed sufficiently important.
It would involve three member <tt>swap</tt> overloads instead of the current
one: </p>

<blockquote><pre>
template &lt;class T&gt;
class container
{
    ...
    void swap(container&amp;)  &amp;;
    void swap(container&amp;&amp;) &amp;;
    void swap(container&amp;) &amp;&amp;;
    ...
};
</pre></blockquote>

</blockquote>

<p>
-1- Headers <tt>&lt;deque&gt;</tt>, <tt>&lt;list&gt;</tt>,
<tt>&lt;queue&gt;</tt>, <tt>&lt;stack&gt;</tt>, and <tt>&lt;vector&gt;</tt>.
</p>

<p>
<b>Header</b> <tt>&lt;deque&gt;</tt> <b>synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Allocator = allocator&lt;T&gt; &gt; class deque;
  template &lt;class T, class Allocator&gt;
    bool operator==
      (const deque&lt;T,Allocator&gt;&amp; x, const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&lt;
      (const deque&lt;T,Allocator&gt;&amp; x, const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator!=
      (const deque&lt;T,Allocator&gt;&amp; x, const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&gt;
      (const deque&lt;T,Allocator&gt;&amp; x, const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&gt;=
      (const deque&lt;T,Allocator&gt;&amp; x, const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&lt;=
      (const deque&lt;T,Allocator&gt;&amp; x, const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    void swap(deque&lt;T,Allocator&gt;&amp; x, deque&lt;T,Allocator&gt;&amp; y);
  <ins>template &lt;class T, class Allocator&gt;
    void swap(deque&lt;T,Allocator&gt;&amp;&amp; x, deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    void swap(deque&lt;T,Allocator&gt;&amp; x, deque&lt;T,Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<p>
<b>Header</b> <tt>&lt;list&gt;</tt> <b>synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Allocator = allocator&lt;T&gt; &gt; class list;
  template &lt;class T, class Allocator&gt;
    bool operator==(const list&lt;T,Allocator&gt;&amp; x, const list&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&lt; (const list&lt;T,Allocator&gt;&amp; x, const list&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator!=(const list&lt;T,Allocator&gt;&amp; x, const list&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&gt; (const list&lt;T,Allocator&gt;&amp; x, const list&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&gt;=(const list&lt;T,Allocator&gt;&amp; x, const list&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&lt;=(const list&lt;T,Allocator&gt;&amp; x, const list&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    void swap(list&lt;T,Allocator&gt;&amp; x, list&lt;T,Allocator&gt;&amp; y);
  <ins>template &lt;class T, class Allocator&gt;
    void swap(list&lt;T,Allocator&gt;&amp;&amp x, list&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    void swap(list&lt;T,Allocator&gt;&amp; x, list&lt;T,Allocator&gt;&amp;&amp y);</ins>
}
</pre></blockquote>

<p>
<b>Header</b> <tt>&lt;queue&gt;</tt> <b>synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Container = deque&lt;T&gt; &gt; class queue;
  template &lt;class T, class Container&gt;
    bool operator==(const queue&lt;T, Container&gt;&amp; x,
		    const queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&lt; (const queue&lt;T, Container&gt;&amp; x,
		    const queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator!=(const queue&lt;T, Container&gt;&amp; x,
		    const queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&gt; (const queue&lt;T, Container&gt;&amp; x,
		    const queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&gt;=(const queue&lt;T, Container&gt;&amp; x,
		    const queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&lt;=(const queue&lt;T, Container&gt;&amp; x,
		    const queue&lt;T, Container&gt;&amp; y);
  <ins>template &lt;class T, class Container&gt;
    void swap(queue&lt;T, Container&gt;&amp; x,
              queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    void swap(queue&lt;T, Container&gt;&amp;&amp; x,
              queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    void swap(queue&lt;T, Container&gt;&amp; x,
              queue&lt;T, Container&gt;&amp;&amp; y);</ins>

  template &lt;class T, class Container = vector&lt;T&gt;,
	    class Compare = less&lt;typename Container::value_type&gt; &gt;
  class priority_queue;
  <ins>template &lt;class T, class Container, class Compare&gt;
    void swap(priority_queue&lt;T, Container, Compare&gt;&amp; x,
              priority_queue&lt;T, Container, Compare&gt;&amp; y);
  template &lt;class T, class Container, class Compare&gt;
    void swap(priority_queue&lt;T, Container, Compare&gt;&amp;&amp; x,
              priority_queue&lt;T, Container, Compare&gt;&amp; y);
  template &lt;class T, class Container, class Compare&gt;
    void swap(priority_queue&lt;T, Container, Compare&gt;&amp; x,
              priority_queue&lt;T, Container, Compare&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<p>
<b>Header</b> <tt>&lt;stack&gt;</tt> <b>synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Container = deque&lt;T&gt; &gt; class stack;
  template &lt;class T, class Container&gt;
    bool operator==(const stack&lt;T, Container&gt;&amp; x,
		    const stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&lt; (const stack&lt;T, Container&gt;&amp; x,
		    const stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator!=(const stack&lt;T, Container&gt;&amp; x,
		    const stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&gt; (const stack&lt;T, Container&gt;&amp; x,
		    const stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&gt;=(const stack&lt;T, Container&gt;&amp; x,
		    const stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&lt;=(const stack&lt;T, Container&gt;&amp; x,
		    const stack&lt;T, Container&gt;&amp; y);
  <ins>template &lt;class T, class Container&gt;
    void swap(stack&lt;T, Container&gt;&amp; x, stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    void swap(stack&lt;T, Container&gt;&amp;&amp; x, stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    void swap(stack&lt;T, Container&gt;&amp; x, stack&lt;T, Container&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<p>
<b>Header</b> <tt>&lt;vector&gt;</tt> <b>synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Allocator = allocator&lt;T&gt; &gt; class vector;
  template &lt;class T, class Allocator&gt;
    bool operator==(const vector&lt;T,Allocator&gt;&amp; x,
		    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&lt; (const vector&lt;T,Allocator&gt;&amp; x,
		    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator!=(const vector&lt;T,Allocator&gt;&amp; x,
		    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&gt; (const vector&lt;T,Allocator&gt;&amp; x,
		    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&gt;=(const vector&lt;T,Allocator&gt;&amp; x,
		    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&lt;=(const vector&lt;T,Allocator&gt;&amp; x,
		    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    void swap(vector&lt;T,Allocator&gt;&amp; x, vector&lt;T,Allocator&gt;&amp; y);
  <ins>template &lt;class T, class Allocator&gt;
    void swap(vector&lt;T,Allocator&gt;&amp;&amp; x, vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    void swap(vector&lt;T,Allocator&gt;&amp; x, vector&lt;T,Allocator&gt;&amp;&amp; y);</ins>

  template &lt;class Allocator&gt; class vector&lt;bool,Allocator&gt;;
<del>  template &lt;class Allocator&gt;
    bool operator==(const vector&lt;bool,Allocator&gt;&amp; x,
		    const vector&lt;bool,Allocator&gt;&amp; y);
  template &lt;class Allocator&gt;
    bool operator&lt; (const vector&lt;bool,Allocator&gt;&amp; x,
		    const vector&lt;bool,Allocator&gt;&amp; y);
  template &lt;class Allocator&gt;
    bool operator!=(const vector&lt;bool,Allocator&gt;&amp; x,
		    const vector&lt;bool,Allocator&gt;&amp; y);
  template &lt;class Allocator&gt;
    bool operator&gt; (const vector&lt;bool,Allocator&gt;&amp; x,
		    const vector&lt;bool,Allocator&gt;&amp; y);
  template &lt;class Allocator&gt;
    bool operator&gt;=(const vector&lt;bool,Allocator&gt;&amp; x,
		    const vector&lt;bool,Allocator&gt;&amp; y);
  template &lt;class Allocator&gt;
    bool operator&lt;=(const vector&lt;bool,Allocator&gt;&amp; x,
		    const vector&lt;bool,Allocator&gt;&amp; y);
  template &lt;class Allocator&gt;
    void swap(vector&lt;bool,Allocator&gt;&amp; x, vector&lt;bool,Allocator&gt;&amp; y);</del>
}
</pre></blockquote>

<h3><a name="23.2.1 - Class template deque"></a>23.2.1 - Class template <tt>deque</tt></h3>

<blockquote class="note">
<p>
The rationale below applies to all sequences. </p>

<p>
Each sequence currently has a constructor similar to the <tt>deque</tt>
constructor: </p>

<blockquote><pre>
explicit deque(size_type n, const T&amp; value = T(), const Allocator&amp; = Allocator());
</pre></blockquote>

<p>
This paper proposes that this constructor be split into two as follows: </p>

<blockquote><pre>
explicit deque(size_type n);
deque(size_type n, const T&amp; value, const Allocator&amp; = Allocator());
</pre></blockquote>

<p>
The rationale for this change is to allow the <tt>size_type</tt> constructor to
work with types which aren't <tt>CopyConstructible</tt>.  That is, the first
(proposed) constructor would default construct <tt>n value_type</tt>'s into the
container instead of today's behavior of default constructing one
<tt>value_type</tt> and then copy constructing that <tt>value n</tt> times. This
will allow (for example): </p>

<blockquote><pre>
deque&lt;unique_ptr&lt;T&gt;&gt; c(100);  // ok, 100 unique_ptr's default constructed
</pre></blockquote>

<p>
The second (proposed) constructor still requires <tt>CopyConstructible</tt> and
so can not be used with movable but non-copyable types such as
<tt>unique_ptr</tt>. </p>

<p>
The member function <tt>resize</tt> is similarly split into two for the exact
same reasons.  The second signature still takes its parameter by value instead
of by const reference.  This does not reflect the author's preference.  Rather
that is a separate issue and not addressed in this paper. </p>

<p>
All member functions which insert (or append, prepend, etc.) a single
<tt>value_type</tt> into the container are overloaded with a member function
that accepts that <tt>value_type</tt> by rvalue reference so that single
<tt>value_type</tt>'s can be moved into the container.  This not only makes
working with heavy weight types much more efficient, it also allows one to
insert movable but non-copyable types into the container. </p>

<p>
Finally, this paper makes a purely editorial statement by suggesting that
redundant template parameters in the member functions be removed.  For example:
</p>

<blockquote><pre>
deque(const deque<del>&lt;T,Allocator&gt;</del>&amp; x);
</pre></blockquote>

<p>
There is no new functionality being proposed here.  I'm simply trying to make
the standard a little easier to read. </p>

</blockquote>

<p>
-2- A <tt>deque</tt> satisfies all of the requirements of a container and of a
reversible container (given in tables in
<a href="lib-containers.html#lib.container.requirements">
lib.container.requirements</a>)
and of a sequence, including the optional sequence requirements
(<a href="lib-containers.html#lib.sequence.reqmts">lib.sequence.reqmts</a>).
Descriptions are provided here only for operations on <tt>deque</tt> that are
not described in one of these tables or for operations where there is additional
semantic information.
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Allocator = allocator&lt;T&gt; &gt;
  class deque {
  public:
    //<i>  types:</i>
    typedef typename Allocator::reference         reference;
    typedef typename Allocator::const_reference   const_reference;
    typedef <b>implementation defined</b>                iterator;        //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                const_iterator;  //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                size_type;       //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                difference_type; //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef T                                     value_type;
    typedef Allocator                             allocator_type;
    typedef typename Allocator::pointer           pointer;
    typedef typename Allocator::const_pointer     const_pointer;
    typedef std::reverse_iterator&lt;iterator&gt;       reverse_iterator;
    typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;

    //<i>  <a href="lib-containers.html#lib.deque.cons">lib.deque.cons</a> construct/copy/destroy:</i>
    explicit deque(const Allocator&amp; = Allocator());
    <ins>explicit deque(size_type n);</ins>
    <del>explicit </del>deque(size_type n, const T&amp; value<del> = T()</del>,
        const Allocator&amp; = Allocator());
    template &lt;class InputIterator&gt;
      deque(InputIterator first, InputIterator last,
            const Allocator&amp; = Allocator());
    deque(const deque<del>&lt;T,Allocator&gt;</del>&amp; x);
    <ins>deque(deque&amp;&amp; x);</ins>
   ~deque();
    deque<del>&lt;T,Allocator&gt;</del>&amp; operator=(const deque<del>&lt;T,Allocator&gt;</del>&amp; x);
    <ins>deque&amp; operator=(deque&amp;&amp; x);</ins>
    template &lt;class InputIterator&gt;
      void assign(InputIterator first, InputIterator last);
    void assign(size_type n, const T&amp; t);
    allocator_type get_allocator() const;

    //<i>  iterators:</i>
    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;

    //<i>  <a href="lib-containers.html#lib.deque.capacity">lib.deque.capacity</a> capacity:</i>
    size_type size() const;
    size_type max_size() const;
    <ins>void      resize(size_type sz);</ins>
    void      resize(size_type sz, T c<del> = T()</del>);
    bool      empty() const;

    //<i>  element access:</i>
    reference       operator[](size_type n);
    const_reference operator[](size_type n) const;
    reference       at(size_type n);
    const_reference at(size_type n) const;
    reference       front();
    const_reference front() const;
    reference       back();
    const_reference back() const;

    //<i>  <a href="lib-containers.html#lib.deque.modifiers">lib.deque.modifiers</a> modifiers:</i>
    void push_front(const T&amp; x);
    <ins>void push_front(T&amp;&amp; x);</ins>
    void push_back(const T&amp; x);
    <ins>void push_back(T&amp;&amp; x);</ins>

    iterator insert(iterator position, const T&amp; x);
    <ins>iterator insert(iterator position, T&amp;&amp; x);</ins>
    void     insert(iterator position, size_type n, const T&amp; x);
    template &lt;class InputIterator&gt;
      void insert (iterator position,
                   InputIterator first, InputIterator last);

    void pop_front();
    void pop_back();

    iterator erase(iterator position);
    iterator erase(iterator first, iterator last);
    void     swap(deque<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins>);
    void     clear();
  };

  template &lt;class T, class Allocator&gt;
    bool operator==(const deque&lt;T,Allocator&gt;&amp; x,
                    const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&lt; (const deque&lt;T,Allocator&gt;&amp; x,
                    const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator!=(const deque&lt;T,Allocator&gt;&amp; x,
                    const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&gt; (const deque&lt;T,Allocator&gt;&amp; x,
                    const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&gt;=(const deque&lt;T,Allocator&gt;&amp; x,
                    const deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&lt;=(const deque&lt;T,Allocator&gt;&amp; x,
                    const deque&lt;T,Allocator&gt;&amp; y);

  //<i>  specialized algorithms:</i>
  template &lt;class T, class Allocator&gt;
    void swap(deque&lt;T,Allocator&gt;&amp; x, deque&lt;T,Allocator&gt;&amp; y);
  <ins>template &lt;class T, class Allocator&gt;
    void swap(deque&lt;T,Allocator&gt;&amp;&amp; x, deque&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    void swap(deque&lt;T,Allocator&gt;&amp; x, deque&lt;T,Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="23.2.1.1 - deque constructors, copy, and assignment"></a>23.2.1.1 - <tt>deque</tt> constructors, copy, and assignment</h4>

<blockquote class="note">
<p>
A description is added to support splitting the <tt>size,value,allocator</tt>
constructor in two.  We also need to add an explicit note that the new
<tt>size,value,allocator</tt> constructor requires <tt>CopyConstructible</tt>
since now this requirement is not assumed. </p>

<p>
A statement about the <tt>CopyConstructible</tt> requirement is also added to
the member template constructor.  Note that this constructor doesn't always
require <tt>CopyConstructible</tt>! (e.g. see <tt>move_iterator</tt>). This
constructor also needs to promise not to dereference each iterator in the input
range so that <tt>move_iterator</tt> can be used here. </p>

<p>
Similar changes concerning requirements are made for the <tt>assign</tt>
functions. </p>
</blockquote>

<blockquote><pre>
explicit deque(const Allocator&amp; = Allocator());
</pre></blockquote>

<p>
-1- <b>Effects:</b> Constructs an empty <tt>deque</tt>, using the specified
allocator.
</p>

<p>
-2- <b>Complexity:</b> Constant.
</p>

<blockquote><pre><ins>
explicit deque(size_type <tt><i>n</i></tt>);
</ins></pre></blockquote>

<p><ins>
-3- <b>Effects:</b> Constructs a <tt>deque</tt> with <tt><i>n</i></tt> default
constructed elements. [<i>Note:</i> Requires <tt>T</tt> to be default
constructible. --<i>end note</i>]
</ins></p>

<p><ins>
-4- <b>Complexity:</b> Linear in <tt><i>n</i></tt>.
</ins></p>

<blockquote><pre>
<del>explicit </del>deque(size_type <i>n</i>, const T&amp; <i>value</i><del> = T()</del>,
               const Allocator&amp; = Allocator());
</pre></blockquote>

<p>
-5- <b>Effects:</b> Constructs a <tt>deque</tt> with <tt><i>n</i></tt> copies of
<tt><i>value</i></tt>, using the specified allocator.
</p>

<p><ins>
-6- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt>.
</ins></p>

<p>
-7- <b>Complexity:</b> Linear in <tt><i>n</i></tt>.
</p>

<blockquote><pre>
template &lt;class InputIterator&gt;
  deque(InputIterator <tt><i>first</i></tt>, InputIterator <tt><i>last</i></tt>,
        const Allocator&amp; = Allocator());
</pre></blockquote>

<p>
-8- <b>Effects:</b> Constructs a <tt>deque</tt> equal to the the range
<tt>[<i>first</i>, <i>last</i>)</tt>, using the specified allocator.  <ins>Each
iterator in the range <tt>[<i>first</i>, <i>last</i>)</tt> is dereferenced
exactly once.</ins>
</p>

<p><ins>
-9- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt> only if
the dereferenced <tt>InputIterator</tt> returns an lvalue or const rvalue.
</ins></p>

<p>
-10- <b>Complexity:</b> <del>Makes </del><tt>distance(<i>first</i>,
<i>last</i>)</tt><del> calls to the copy constructor of <tt>T</tt></del>.
</p>

<blockquote><pre>
template &lt;class InputIterator&gt;
  void assign(InputIterator first, InputIterator last);
</pre></blockquote>

<p>
-11- <b>Effects:</b>
</p>

<blockquote><pre>
erase(begin(), end());
insert(begin(), first, last);
</pre></blockquote>

<p><ins>
Each iterator in the range <tt>[<i>first</i>, <i>last</i>)</tt> is dereferenced
exactly once.
</ins></p>

<p><ins>
-12- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt> and
<tt>CopyAssignable</tt> only if the dereferenced <tt>InputIterator</tt> returns
an lvalue or const rvalue.
</ins></p>

<blockquote><pre>
void assign(size_type n, const T&amp; t);
</pre></blockquote>

<p>
-13- <b>Effects:</b>
</p>

<blockquote><pre>
erase(begin(), end());
insert(begin(), n, t);
</pre></blockquote>

<p><ins>
-14- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt> and
<tt>CopyAssignable</tt>.
</ins></p>

<h4><a name="23.2.1.2 - deque capacity"></a>23.2.1.2 - <tt>deque</tt> capacity</h4>

<blockquote class="note">
<p>
<tt>resize</tt> is split into two overloads.  The first supports moveable but
non-copyable types.  The second now explicitly requires
<tt>CopyConstructible</tt>. Note that the <tt>insert</tt> function used in the
effects clause requires not only <tt>CopyConstructible</tt> but also
<tt>CopyAssignable</tt>.  But <tt>resize</tt> will never actually use
<tt>CopyAssignable</tt> and therefore should not require it. Thus the code used
to describe the effects of the second <tt>resize</tt> overload can't be used in
an actual implementation. </p>
</blockquote>

<blockquote><pre><ins>
void resize(size_type sz);
</ins></pre></blockquote>

<p><ins>
-1- <b>Effects:</b> If <tt>sz</tt> is less than <tt>size()</tt> then <tt>size()
- sz</tt> elements are erased from the end of the sequence.  Else <tt>sz -
size()</tt> default constructed elements are appended to the sequence.
</ins></p>

<p><ins>
-2- <b>Requires:</b> <tt>T</tt> must be default constructible.
</ins></p>

<blockquote><pre>
void resize(size_type sz, T c<del> = T()</del>);
</pre></blockquote>

<p>
-3- <b>Effects:</b>
</p>

<blockquote><pre>
if (sz &gt; size())
  insert(end(), sz-size(), c);
else if (sz &lt; size())
  erase(begin()+sz, end());
else
  ;                           // <i>do nothing</i>
</pre></blockquote>

<p><ins>
-4- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt>.
</ins></p>

<h4><a name="23.2.1.3 - deque modifiers"></a>23.2.1.3 - <tt>deque</tt> modifiers</h4>

<blockquote class="note">
<p>
Descriptions are added for <tt>push_front</tt> and <tt>push_back</tt> for the
reason of adding the <tt>CopyConstructible</tt> requirement to the overload
taking a <tt>const T&amp;</tt>, and to introduce the overload taking a
<tt>T&amp;&amp;</tt> parameter. </p>

<p>
The <tt>insert</tt> descriptions are updated with the new overload, and new
<tt>CopyConstructible</tt> and <tt>CopyAssignable</tt> requirements as
appropriate.  The "dereference once" promise is also added to the member
template overload so that it can be used with iterators such as
<tt>move_iterator</tt>.  For example: </p>

<blockquote><pre>
deque&lt;string&gt; d1, d2;
...
d2.insert(d2.end(), make_move_iterator(d1.begin()), make_move_iterator(d1.end());
</pre></blockquote>

<p>
In the above example the <tt>string</tt>'s in <tt>d1</tt> are <i>moved</i> as
they are appended to <tt>d2</tt>. </p>
</blockquote>

<blockquote><pre><ins>
void push_front(const T&amp; x);
void push_front(T&amp;&amp; x);
</ins></pre></blockquote>

<p><ins>
-1- <b>Effects:</b> Prepends a copy of x to the beginning of the sequence.
</ins></p>

<p><ins>
-2- <b>Requires:</b> The signature with a <tt>const T&amp;</tt> parameter
requires <tt>T</tt> to be <tt>CopyConstructible</tt>.
</ins></p>

<blockquote><pre><ins>
void push_back(const T&amp; x);
void push_back(T&amp;&amp; x);
</ins></pre></blockquote>

<p><ins>
-3- <b>Effects:</b> Appends a copy of x to the end of the sequence.
</ins></p>

<p><ins>
-4- <b>Requires:</b> The signature with a <tt>const T&amp;</tt> parameter
requires <tt>T</tt> to be <tt>CopyConstructible</tt>.
</ins></p>

<blockquote><pre>
iterator insert(iterator position, const T&amp; x);
<ins>iterator insert(iterator position, T&amp;&amp; x);</ins>
void     insert(iterator position, size_type n, const T&amp; x);
template &lt;class InputIterator&gt;
  void insert(iterator position,
              InputIterator first, InputIterator last);
</pre></blockquote>

<p>
-3- <b>Effects:</b>
An insert in the middle of the deque invalidates all the iterators and
references to elements of the deque. An insert at either end of the deque
invalidates all the iterators to the deque, but has no effect on the validity of
references to elements of the deque.  <ins>Each iterator in the range
<tt>[<i>first</i>, <i>last</i>)</tt> is dereferenced exactly once.</ins>
</p>

<p>
-4- <b>Notes:</b>
If an exception is thrown other than by the copy constructor or assignment
operator of <tt>T</tt> there are no effects.  <ins>The signatures taking a
<tt>const T&amp;</tt> parameter require <tt>T</tt> to be
<tt>CopyConstructible</tt> and <tt>CopyAssignable</tt>. The signature taking
<tt>InputIterator</tt> parameters requires <tt>T</tt> to be
<tt>CopyConstructible</tt> and <tt>CopyAssignable</tt> only if the dereferenced
<tt>InputIterator</tt> returns an lvalue or const rvalue.</ins>
</p>

<p>
-5- <b>Complexity:</b>
In the worst case, inserting a single element into a deque takes time linear in
the minimum of the distance from the insertion point to the beginning of the
deque and the distance from the insertion point to the end of the deque.
Inserting a single element either at the beginning or end of a deque always
takes constant time and causes a single call to the copy constructor of
<tt>T</tt>.
</p>

<h4><a name="23.2.1.4 - deque specialized algorithms"></a>23.2.1.4 - <tt>deque</tt> specialized algorithms</h4>

<blockquote class="note">
<p>
Simply add the additional <tt>swap</tt> signatures: </p>
</blockquote>

<blockquote><pre>
template &lt;class T, class Allocator&gt;
  void swap(deque&lt;T,Allocator&gt;&amp; x, deque&lt;T,Allocator&gt;&amp; y);
<ins>template &lt;class T, class Allocator&gt;
  void swap(deque&lt;T,Allocator&gt;&amp;&amp; x, deque&lt;T,Allocator&gt;&amp; y);
template &lt;class T, class Allocator&gt;
  void swap(deque&lt;T,Allocator&gt;&amp; x, deque&lt;T,Allocator&gt;&amp;&amp; y);</ins>
</pre></blockquote>

<p>
-1- <b>Effects:</b>
</p>

<blockquote><pre>
x.swap(y);
</pre></blockquote>

<h3><a name="23.2.2 - Class template list"></a>23.2.2 - Class template <tt>list</tt></h3>

<blockquote class="note">
<p>
Most of the rationale for the changes to <tt>list</tt> is the same as for
<tt>deque</tt>.
Please refer to the <a href="#23.2.1 - Class template deque"><tt>deque</tt>
rationale</a>
for details that are not <tt>list</tt>-specific. </p>

<p>
The <tt>splice</tt> and <tt>merge</tt> member functions have been modified to
now accept either lvalue or rvalue <tt>list</tt>s.  Otherwise the functionality
of these members is unchanged (they already move from their arguments). </p>
</blockquote>

<p>
-2- A <tt>list</tt> satisfies all of the requirements of a container and of a
reversible container
(given in two tables in <a
href="lib-containers.html#lib.container.requirements">lib.container.requirements</a>)
and of a sequence,
including most of the the optional sequence requirements (<a
href="lib-containers.html#lib.sequence.reqmts">lib.sequence.reqmts</a>).
The exceptions are the <tt>operator[]</tt> and <tt>at</tt> member functions,
which are not provided.*
</p>

<blockquote>[Footnote:
These member functions are only provided by containers whose iterators are
random access iterators. --- end foonote]
</blockquote>

<p>
Descriptions are provided here only for operations on <tt>list</tt> that are not
described in one of these tables or for operations where there is additional
semantic information.
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Allocator = allocator&lt;T&gt; &gt;
  class list {
  public:
    //<i>  types:</i>
    typedef typename Allocator::reference         reference;
    typedef typename Allocator::const_reference   const_reference;
    typedef <b>implementation defined</b>                iterator;       //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                const_iterator; //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                size_type;      //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                difference_type;//<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef T                                     value_type;
    typedef Allocator                             allocator_type;
    typedef typename Allocator::pointer           pointer;
    typedef typename Allocator::const_pointer     const_pointer;
    typedef std::reverse_iterator&lt;iterator&gt;       reverse_iterator;
    typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;

    //<i>  <a href="lib-containers.html#lib.list.cons">lib.list.cons</a> construct/copy/destroy:</i>
    explicit list(const Allocator&amp; = Allocator());
    <ins>explicit list(size_type <i>n</i>);</ins>
    <del>explicit </del>list(size_type <i>n</i>, const T&amp; <i>value</i><del> = T()</del>,
		  const Allocator&amp; = Allocator());
    template &lt;class InputIterator&gt;
      list(InputIterator <i>first</i>, InputIterator <i>last</i>,
	   const Allocator&amp; = Allocator());
    list(const list<del>&lt;T,Allocator&gt;</del>&amp; <i>x</i>);
    <ins>list(list&amp;&amp; <i>x</i>);</ins>
   ~list();
    list<del>&lt;T,Allocator&gt;</del>&amp; operator=(const list<del>&lt;T,Allocator&gt;</del>&amp; <i>x</i>);
    <ins>list&amp; operator=(list&amp;&amp; <i>x</i>);</ins>
    template &lt;class InputIterator&gt;
      void assign(InputIterator first, InputIterator last);
    void assign(size_type n, const T&amp; t);
    allocator_type get_allocator() const;

    // <i>iterators:</i>
    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;

    // <i><a href="lib-containers.html#lib.list.capacity">lib.list.capacity</a> capacity:</i>
    bool      empty() const;
    size_type size() const;
    size_type max_size() const;
    <ins>void      resize(size_type sz);</ins>
    void      resize(size_type sz, T c<del> = T()</del>);

    // <i>element access:</i>
    reference       front();
    const_reference front() const;
    reference       back();
    const_reference back() const;

    // <i><a href="lib-containers.html#lib.list.modifiers">lib.list.modifiers</a> modifiers:</i>
    void push_front(const T&amp; <i>x</i>);
    <ins>void push_front(T&amp;&amp; <i>x</i>);</ins>
    void pop_front();
    void push_back(const T&amp; <i>x</i>);
    <ins>void push_back(T&amp;&amp; <i>x</i>);</ins>
    void pop_back();

    iterator insert(iterator <i>position</i>, const T&amp; <i>x</i>);
    <ins>iterator insert(iterator <i>position</i>, T&amp;&amp; <i>x</i>);</ins>
    void     insert(iterator <i>position</i>, size_type <i>n</i>, const T&amp; <i>x</i>);
    template &lt;class InputIterator&gt;
      void insert(iterator <i>position</i>, InputIterator <i>first</i>,
		  InputIterator <i>last</i>);

    iterator erase(iterator <i>position</i>);
    iterator erase(iterator <i>position</i>, iterator <i>last</i>);
    void     swap(list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins>);
    void     clear();

    // <i><a href="lib-containers.html#lib.list.ops">lib.list.ops</a> list operations:</i>
    void splice(iterator <i>position</i>, list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins> <i>x</i>);
    void splice(iterator <i>position</i>, list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins> <i>x</i>, iterator <i>i</i>);
    void splice(iterator <i>position</i>, list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins> <i>x</i>, iterator <i>first</i>,
		iterator <i>last</i>);

    void remove(const T&amp; <i>value</i>);
    template &lt;class Predicate&gt; void remove_if(Predicate <i>pred</i>);

    void unique();
    template &lt;class BinaryPredicate&gt;
      void unique(BinaryPredicate <i>binary_pred</i>);

    void merge(list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins> <i>x</i>);
    template &lt;class Compare&gt; void merge(list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins> <i>x</i>, Compare <i>comp</i>);

    void sort();
    template &lt;class Compare&gt; void sort(Compare <i>comp</i>);

    void reverse();
  };

  template &lt;class T, class Allocator&gt;
    bool operator==(const list&lt;T,Allocator&gt;&amp; <i>x</i>, const list&lt;T,Allocator&gt;&amp; <i>y</i>);
  template &lt;class T, class Allocator&gt;
    bool operator&lt; (const list&lt;T,Allocator&gt;&amp; <i>x</i>, const list&lt;T,Allocator&gt;&amp; <i>y</i>);
  template &lt;class T, class Allocator&gt;
    bool operator!=(const list&lt;T,Allocator&gt;&amp; <i>x</i>, const list&lt;T,Allocator&gt;&amp; <i>y</i>);
  template &lt;class T, class Allocator&gt;
    bool operator&gt; (const list&lt;T,Allocator&gt;&amp; <i>x</i>, const list&lt;T,Allocator&gt;&amp; <i>y</i>);
  template &lt;class T, class Allocator&gt;
    bool operator&gt;=(const list&lt;T,Allocator&gt;&amp; <i>x</i>, const list&lt;T,Allocator&gt;&amp; <i>y</i>);
  template &lt;class T, class Allocator&gt;
    bool operator&lt;=(const list&lt;T,Allocator&gt;&amp; <i>x</i>, const list&lt;T,Allocator&gt;&amp; <i>y</i>);

  //<i>  specialized algorithms:</i>
  template &lt;class T, class Allocator&gt;
    void swap(list&lt;T,Allocator&gt;&amp; x, list&lt;T,Allocator&gt;&amp; y);
  <ins>template &lt;class T, class Allocator&gt;
    void swap(list&lt;T,Allocator&gt;&amp;&amp; x, list&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    void swap(list&lt;T,Allocator&gt;&amp; x, list&lt;T,Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="23.2.2.1 - list constructors, copy, and assignment"></a>23.2.2.1 - <tt>list</tt> constructors, copy, and assignment</h4>

<blockquote><pre>
explicit list(const Allocator&amp; = Allocator());
</pre></blockquote>

<p>
-1- <b>Effects:</b>
Constructs an empty list, using the specified allocator.
</p>

<p>
-2- <b>Complexity:</b> Constant.
</p>

<blockquote><pre><ins>
explicit list(size_type <i>n</i>);
</ins></pre></blockquote>

<p><ins>
-3- <b>Effects:</b> Constructs a <tt>list</tt> with <tt><i>n</i></tt> default
constructed elements.
</ins></p>

<p><ins>
-4- <b>Requires:</b> <tt>T</tt> must be default constructible.
</ins></p>

<p><ins>
-5- <b>Complexity:</b> Linear in <tt><i>n</i></tt>.
</ins></p>

<blockquote><pre>
<del>explicit </del>list(size_type <i>n</i>, const T&amp; <i>value</i><del> = T()</del>,
              const Allocator&amp; = Allocator());
</pre></blockquote>

<p>
-6- <b>Effects:</b> Constructs a <tt>list</tt> with <tt>n</tt>
copies of <tt>value</tt>, using the specified allocator.
</p>

<p><ins>
-7- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt>.
</ins></p>

<p>
-8- <b>Complexity:</b> Linear in <tt>n</tt>.
</p>

<blockquote><pre>
template &lt;class InputIterator&gt;
list(InputIterator <i>first</i>, InputIterator <i>last</i>,
     const Allocator&amp; = Allocator());
</pre></blockquote>

<p>
-9- <b>Effects:</b> Constructs a <tt>list</tt> equal to the range
<tt>[<i>first</i>, <i>last</i>)</tt>.  <ins>Each iterator in the range
<tt>[<i>first</i>, <i>last</i>)</tt> is dereferenced exactly once.</ins>
</p>

<p><ins>
-10- <b>Requires:</b> <tt>T</tt> must be
<tt>CopyConstructible</tt> only if the dereferenced <tt>InputIterator</tt>
returns an lvalue or const rvalue.
</ins></p>

<p>
-11- <b>Complexity:</b> Linear in <tt><i>first</i> - <i>last</i></tt>.
</p>

<blockquote><pre>
template &lt;class InputIterator&gt;
  void assign(InputIterator first, InputIterator last);
</pre></blockquote>

<p>
-12- <b>Effects:</b>
</p>

<blockquote><pre>
erase(begin(), end());
insert(begin(), first, last);
</pre></blockquote>

<p><ins>
Each iterator in the range <tt>[<i>first</i>, <i>last</i>)</tt> is dereferenced
exactly once.
</ins></p>

<p><ins>
-13- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt> and
<tt>CopyAssignable</tt> only if the dereferenced <tt>InputIterator</tt> returns
an lvalue or const rvalue.
</ins></p>

<blockquote><pre>
void assign(size_type n, const T&amp; t);
</pre></blockquote>

<p>
-14- <b>Effects:</b>
</p>

<blockquote><pre>
erase(begin(), end());
insert(begin(), n, t);
</pre></blockquote>

<p><ins>
-15- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt> and
<tt>CopyAssignable</tt>.
</ins></p>

<h4><a name="23.2.2.2 - list capacity"></a>23.2.2.2 - <b>list</b> capacity</h4>

<blockquote><pre><ins>
void resize(size_type sz);
</ins></pre></blockquote>

<p><ins>
-1- <b>Effects:</b> If <tt>sz</tt> is less than <tt>size()</tt> then <tt>size()
- sz</tt> elements are erased from the end of the sequence.  Else <tt>sz -
size()</tt> default constructed elements are appended to the sequence.
</ins></p>

<p><ins>
-2- <b>Requires:</b> <tt>T</tt> must be default constructible.
</ins></p>

<blockquote><pre>
void resize(size_type sz, T c<del> = T()</del>);
</pre></blockquote>

<p>
-3- <b>Effects:</b>
</p>

<blockquote><pre>
if (sz &gt; size())
  insert(end(), sz-size(), c);
else if (sz &lt; size()) {
  iterator i = begin();
  advance(i, sz);
  erase(i, end());
}
else
  ;                           // <i>do nothing</i>
</pre></blockquote>

<p><ins>
-4- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt>.
</ins></p>

<h4><a name="23.2.2.3 - list modifiers"></a>23.2.2.3 - <b>list</b> modifiers</h4>

<blockquote><pre>
iterator insert(iterator <i>position</i>, const T&amp; <i>x</i>);
<ins>iterator insert(iterator <i>position</i>, T&amp;&amp; <i>x</i>);</ins>
void     insert(iterator <i>position</i>, size_type <i>n</i>, const T&amp; <i>x</i>);
template &lt;class InputIterator&gt;
  void insert(iterator <i>position</i>, InputIterator <i>first</i>,
              InputIterator <i>last</i>);
</pre></blockquote>

<blockquote><pre>
void push_front(const T&amp; x);
<ins>void push_front(T&amp;&amp; x);</ins>
void push_back(const T&amp; x);
<ins>void push_back(T&amp;&amp; x);</ins>
</pre></blockquote>

<p>
-1- <del><b>Notes:</b></del> <ins><b>Effects:</b></ins>
Does not affect the validity of iterators and references. If an exception is
thrown there are no effects. <ins>Each iterator in the range <tt>[<i>first</i>,
<i>last</i>)</tt> is dereferenced exactly once.</ins>
</p>

<p><ins>
-2- <b>Requires:</b> The signatures with a <tt>const T&amp;</tt> parameter
require <tt>T</tt> to be <tt>CopyConstructible</tt>.  The signature taking
<tt>InputIterator</tt> parameters requires <tt>T</tt> to be
<tt>CopyConstructible</tt> only if the dereferenced <tt>InputIterator</tt>
returns an lvalue or const rvalue.
</ins></p>

<p>
-3- <b>Complexity:</b>
Insertion of a single element into a list takes constant time and exactly one
call to the copy constructor <ins>or move constructor</ins> of <tt>T</tt>.
Insertion of multiple elements into a list is linear in the number of elements
inserted, and the number of calls to the copy constructor <ins>or move
constructor</ins> of <tt>T</tt> is exactly equal to the number of elements
inserted.
</p>

<h4><a name="23.2.2.4 - list operations"></a>23.2.2.4 - <b>list</b> operations</h4>

<p>
-2- <tt>list</tt> provides three splice operations that destructively move
elements from one list to another.
</p>

<blockquote><pre>
void splice(iterator <i>position</i>, list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins> <i>x</i>);
</pre></blockquote>

<p>
-3- <b>Requires:</b> <tt>&amp;<i>x</i> != this</tt>.
</p>

<p>
-6- <b>Complexity:</b> Constant time.
</p>

<blockquote><pre>
void splice(iterator <i>position</i>, list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins> <i>x</i>, iterator <i>i</i>);
</pre></blockquote>

<p>
-7- <b>Effects:</b> Inserts an element pointed to by <tt>i</tt> from list
<tt>x</tt> before position and removes the element from <tt>x</tt>. The result
is unchanged if <tt>position == i</tt> or <tt>position == ++i</tt>. Invalidates
only the iterators and references to the spliced element.
</p>

<p>
-10- <b>Complexity:</b> Constant time.
</p>

<blockquote><pre>
void splice(iterator <i>position</i>, list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins> <i>x</i>, iterator <i>first</i>,
            iterator <i>last</i>;
</pre></blockquote>

<p>
-11- <b>Effects:</b> Inserts elements in the range <tt>[first, last)</tt>
before <tt>position</tt> and removes the elements from <tt>x</tt>.
</p>

<p>
-14- <b>Complexity:</b> Constant time if <tt>&amp;<i>x</i> == this</tt>;
otherwise, linear time.
</p>

<blockquote><pre>
void   merge(list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins> <i>x</i>);
template &lt;class Compare&gt; void merge(list<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins> <i>x</i>, Compare <i>comp</i>);
</pre></blockquote>

<p>
<b>Requires:</b> <tt><i>comp</i></tt> defines a strict weak ordering
(<a href="lib-algorithms.html#lib.alg.sorting">lib.alg.sorting</a>), and the
list and the argument list are both sorted according to this ordering.
</p>

<h4><a name="23.2.2.5 - list specialized algorithms"></a>23.2.2.5 - <b>list</b> specialized algorithms</h4>

<blockquote><pre>
template &lt;class T, class Allocator&gt;
  void swap(list&lt;T,Allocator&gt;&amp; x, list&lt;T,Allocator&gt;&amp; y);
<ins>template &lt;class T, class Allocator&gt;
  void swap(list&lt;T,Allocator&gt;&amp;&amp; x, list&lt;T,Allocator&gt;&amp; y);
template &lt;class T, class Allocator&gt;
  void swap(list&lt;T,Allocator&gt;&amp; x, list&lt;T,Allocator&gt;&amp;&amp; y);</ins>
</pre></blockquote>

<p>
-1- <b>Effects:</b>
</p>

<blockquote><pre>
  x.swap(y);
</pre></blockquote>

<h3><a name="23.2.3 - Container adaptors"></a>23.2.3 - Container adaptors</h3>

<blockquote class="note">
<p>
The main change to the container adaptors is the addition of <tt>swap</tt>
(which they were completely lacking).  Additionally support is added for moving
both containers and elements through the adaptors.  Finally each adaptor is
given a constant complexity move constructor and move assignment operator. </p>
</blockquote>

<h4><a name="23.2.3.1 - Class template queue"></a>23.2.3.1 - Class template <tt>queue</tt></h4>

<p>
-1- Any sequence supporting operations <tt>front()</tt>, <tt>back()</tt>,
<tt>push_back()</tt> and <tt>pop_front()</tt> can be used to instantiate
<tt>queue</tt>. In particular,
<tt>list</tt> (<a href="lib-containers.html#lib.list">lib.list</a>) and
<tt>deque</tt>
(<a href="lib-containers.html#lib.deque">lib.deque</a>) can be used.
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Container = deque&lt;T&gt; &gt;
  class queue {
  public:
    typedef typename Container::value_type            value_type;
    typedef typename Container::size_type             size_type;
    typedef          Container                        container_type;
  protected:
    Container c;

  public:
    explicit queue(const Container&amp;<del> = Container()</del>);
    <ins>explicit queue(Container&amp;&amp; = Container());</ins>
    <ins>queue(queue&amp;&amp; q)            : c(std::move(q.c)) {}</ins>
    <ins>queue&amp; operator=(queue&amp;&amp; q) { c = std::move(q.c); return *this; }</ins>

    bool      empty() const             { return c.empty(); }
    size_type size()  const             { return c.size(); }
    value_type&amp;       front()           { return c.front(); }
    const value_type&amp; front() const     { return c.front(); }
    value_type&amp;       back()            { return c.back(); }
    const value_type&amp; back() const      { return c.back(); }
    void push(const value_type&amp; x)      { c.push_back(x); }
    <ins>void push(value_type&amp;&amp; x)           { c.push_back(std::move(x)); }</ins>
    void pop()                          { c.pop_front(); }
    <ins>void swap(queue&amp;&amp; q)                { c.swap(q.c); }</ins>
  };

  template &lt;class T, class Container&gt;
    bool operator==(const queue&lt;T, Container&gt;&amp; x,
                    const queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&lt; (const queue&lt;T, Container&gt;&amp; x,
                       const queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator!=(const queue&lt;T, Container&gt;&amp; x,
                    const queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&gt; (const queue&lt;T, Container&gt;&amp; x,
                       const queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&gt;=(const queue&lt;T, Container&gt;&amp; x,
                       const queue&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&lt;=(const queue&lt;T, Container&gt;&amp; x,
                       const queue&lt;T, Container&gt;&amp; y);
}
</pre></blockquote>

<blockquote><pre>
operator==
</pre></blockquote>

<p>
-2- <b>Returns:</b> <tt>x.c == y.c</tt>.
</p>

<blockquote><pre>
operator&lt;
</pre></blockquote>

<p>
-3- <b>Returns:</b> <tt>x.c &lt; y.c</tt>.
</p>

<blockquote><pre><ins>
template &lt;class T, class Container&gt;
  void swap(queue&lt;T, Container&gt;&amp; x,
            queue&lt;T, Container&gt;&amp; y);
template &lt;class T, class Container&gt;
  void swap(queue&lt;T, Container&gt;&amp;&amp; x,
            queue&lt;T, Container&gt;&amp; y);
template &lt;class T, class Container&gt;
  void swap(queue&lt;T, Container&gt;&amp; x,
            queue&lt;T, Container&gt;&amp;&amp; y);
</ins></pre></blockquote>

<p><ins>
-4- <b>Effects:</b>  <tt>x.swap(y)</tt>
</ins></p>

<h4><a name="23.2.3.2 - Class template priority_queue"></a>23.2.3.2 - Class template <tt>priority_queue</tt></h4>

<p>
-1- Any sequence with random access iterator and supporting operations
<tt>front()</tt>, <tt>push_back()</tt> and <tt>pop_back()</tt> can be used to
instantiate <tt>priority_queue</tt>. In particular, <tt>vector</tt>
(<a href="lib-containers.html#lib.vector">lib.vector</a>)
and <tt>deque</tt> (<a href="lib-containers.html#lib.deque">lib.deque</a>)
can be used. Instantiating <tt>priority_queue</tt> also involves supplying a
function or function object for making priority comparisons; the library assumes
that the function or function object defines a strict
weak ordering (<a
href="lib-algorithms.html#lib.alg.sorting">lib.alg.sorting</a>).
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Container = vector&lt;T&gt;,
	    class Compare = less&lt;typename Container::value_type&gt; &gt;
  class priority_queue {
  public:
    typedef typename Container::value_type            value_type;
    typedef typename Container::size_type             size_type;
    typedef          Container                        container_type;
  protected:
    Container c;
    Compare comp;

  public:
    <del>explicit </del>priority_queue(const Compare&amp; x<del> = Compare()</del>,
			    const Container&amp;<del> = Container()</del>);
    <ins>explicit priority_queue(const Compare&amp; x = Compare(),
			          Container&amp;&amp; = Container());</ins>
    template &lt;class InputIterator&gt;
      priority_queue(InputIterator first, InputIterator last,
		     const Compare&amp; x<del> = Compare()</del>,
		     const Container&amp;<del> = Container()</del>);
    <ins>template &lt;class InputIterator&gt;
      priority_queue(InputIterator first, InputIterator last,
		     const Compare&amp; x = Compare(),
		           Container&amp;&amp; = Container());</ins>

    <ins>priority_queue(priority_queue&amp;&amp;)</ins>
    <ins>priority_queue&amp; operator=(priority_queue&amp;&amp;)</ins>

    bool      empty() const       { return c.empty(); }
    size_type size()  const       { return c.size(); }
    const value_type&amp; top() const { return c.front(); }
    void push(const value_type&amp; x);
    <ins>void push(value_type&amp;&amp; x);</ins>
    void pop();
    <ins>void swap(priority_queue&amp;&amp;);</ins>
  };
				// <i>no equality is provided</i>

  <ins>template &lt;class T, class Container, class Compare&gt;
    void swap(priority_queue&lt;T, Container, Compare&gt;&amp; x,
              priority_queue&lt;T, Container, Compare&gt;&amp; y);
  template &lt;class T, class Container, class Compare&gt;
    void swap(priority_queue&lt;T, Container, Compare&gt;&amp;&amp; x,
              priority_queue&lt;T, Container, Compare&gt;&amp; y);
  template &lt;class T, class Container, class Compare&gt;
    void swap(priority_queue&lt;T, Container, Compare&gt;&amp; x,
              priority_queue&lt;T, Container, Compare&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h5><a name="23.2.3.2.1 - priority_queue constructors"></a>23.2.3.2.1 - <tt>priority_queue</tt> constructors</h5>

<blockquote><pre>
priority_queue(const Compare&amp; x<del> = Compare()</del>,
               const Container&amp; y<del> = Container()</del>);
<ins>priority_queue(const Compare&amp; x = Compare(),
                     Container&amp;&amp; y = Container());</ins>
</pre></blockquote>

<p>
-1- <b>Requires:</b> <tt><i>x</i></tt> defines a strict weak ordering
(<a href="lib-algorithms.html#lib.alg.sorting">lib.alg.sorting</a>).
</p>

<p>
-2- <b>Effects:</b> Initializes <tt>comp</tt> with <tt>x</tt> and <tt>c</tt>
with <tt>y</tt> <ins>(copy constructing or move constructing from <tt>y</tt> as
appropriate)</ins>; calls <tt>make_heap(c.begin(), c.end(), comp)</tt>.
</p>

<blockquote><pre>
template &lt;class InputIterator&gt;
  priority_queue(InputIterator first, InputIterator last,
                 const Compare&amp; x<del> = Compare()</del>,
                 const Container&amp; y<del> = Container()</del>);
<ins>template &lt;class InputIterator&gt;
  priority_queue(InputIterator first, InputIterator last,
                 const Compare&amp; x = Compare(),
                       Container&amp;&amp; y = Container());</ins>
</pre></blockquote>

<p>
-3- <b>Requires:</b> <tt><i>x</i></tt> defines a strict weak ordering
(<a href="lib-algorithms.html#lib.alg.sorting">lib.alg.sorting</a>).
</p>

<p>
-4- <b>Effects:</b> Initializes <tt>c</tt> with <tt>y</tt> <ins>(copy
constructing or move constructing from <tt>y</tt> as appropriate)</ins> and
<tt>comp</tt> with <tt>x</tt>; calls <tt>c.insert(c.end(), first, last)</tt>;
and finally calls <tt>make_heap(c.begin(), c.end(), comp)</tt>.
</p>

<h5><a name="23.2.3.2.2 - priority_queue members"></a>23.2.3.2.2 - <tt>priority_queue</tt> members</h5>

<blockquote><pre>
void push(const value_type&amp; x);
</pre></blockquote>

<p>
-1- <b>Effects:</b>
</p>

<blockquote><pre>
        c.push_back(x);
        push_heap(c.begin(), c.end(), comp);
</pre></blockquote>

<blockquote><pre><ins>
void push(value_type&amp;&amp; x);
</ins></pre></blockquote>

<p><ins>
-2- <b>Effects:</b>
</ins></p>

<blockquote><pre><ins>
        c.push_back(std::move(x));
        push_heap(c.begin(), c.end(), comp);
</ins></pre></blockquote>

<blockquote><pre>
void pop();
</pre></blockquote>

<p>
-3- <b>Effects:</b>
</p>

<blockquote><pre>
        pop_heap(c.begin(), c.end(), comp);
        c.pop_back();
</pre></blockquote>

<h5><a name="23.2.3.2.3 - priority_queue specialized algorithms"></a><ins>23.2.3.2.3 - <tt>priority_queue</tt> specialized algorithms</ins></h5>

<blockquote><pre><ins>
template &lt;class T, class Container, class Compare&gt;
  void swap(priority_queue&lt;T, Container, Compare&gt;&amp; x,
            priority_queue&lt;T, Container, Compare&gt;&amp; y);
template &lt;class T, class Container, class Compare&gt;
  void swap(priority_queue&lt;T, Container, Compare&gt;&amp;&amp; x,
            priority_queue&lt;T, Container, Compare&gt;&amp; y);
template &lt;class T, class Container, class Compare&gt;
  void swap(priority_queue&lt;T, Container, Compare&gt;&amp; x,
            priority_queue&lt;T, Container, Compare&gt;&amp;&amp; y);
</ins></pre></blockquote>

<p><ins>
-1- <b>Effects:</b> <tt>x.swap(y)</tt>
</ins></p>

<h4><a name="23.2.3.3 - Class template stack"></a>23.2.3.3 - Class template <tt>stack</tt></h4>

<p>
-1- Any sequence supporting operations <tt>back()</tt>, <tt>push_back()</tt> and
<tt>pop_back()</tt> can be used to instantiate <tt>stack</tt>. In particular,
<tt>vector</tt> (<a href="lib-containers.html#lib.vector">lib.vector</a>),
<tt>list</tt> (<a href="lib-containers.html#lib.list">lib.list</a>)
and <tt>deque</tt> (<a href="lib-containers.html#lib.deque">lib.deque</a>)
can be used.
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Container = deque&lt;T&gt; &gt;
  class stack {
  public:
    typedef typename Container::value_type            value_type;
    typedef typename Container::size_type             size_type;
    typedef          Container                        container_type;
  protected:
    Container c;

  public:
    explicit stack(const Container&amp;<del> = Container()</del>);
    <ins>explicit stack(const Container&amp;&amp; = Container());</ins>
    <ins>stack(stack&amp;&amp;);</ins>
    <ins>stack&amp; operator=(stack&amp;&amp;);</ins>

    bool      empty() const             { return c.empty(); }
    size_type size()  const             { return c.size(); }
    value_type&amp;       top()             { return c.back(); }
    const value_type&amp; top() const       { return c.back(); }
    void push(const value_type&amp; x)      { c.push_back(x); }
    <ins>void push(      value_type&amp;&amp; x)     { c.push_back(std::move(x)); }</ins>
    void pop()                          { c.pop_back(); }
    <ins>void swap(stack&amp;&amp; s)                { c.swap(s.c); }</ins>
  };

  template &lt;class T, class Container&gt;
    bool operator==(const stack&lt;T, Container&gt;&amp; x,
                    const stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&lt; (const stack&lt;T, Container&gt;&amp; x,
                    const stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator!=(const stack&lt;T, Container&gt;&amp; x,
                    const stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&gt; (const stack&lt;T, Container&gt;&amp; x,
                    const stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&gt;=(const stack&lt;T, Container&gt;&amp; x,
                    const stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    bool operator&lt;=(const stack&lt;T, Container&gt;&amp; x,
                    const stack&lt;T, Container&gt;&amp; y);

  <ins>template &lt;class T, class Container&gt;
    void swap(stack&lt;T, Container&gt;&amp; x,
              stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    void swap(stack&lt;T, Container&gt;&amp;&amp; x,
              stack&lt;T, Container&gt;&amp; y);
  template &lt;class T, class Container&gt;
    void swap(stack&lt;T, Container&gt;&amp; x,
              stack&lt;T, Container&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h3><a name="23.2.4 - Class template vector"></a>23.2.4 - Class template <tt>vector</tt></h3>

<blockquote class="note">
<p>
Most of the rationale for the changes to <tt>vector</tt> is the same as for
<tt>deque</tt>.
Please refer to the <a href="#23.2.1 - Class template deque"><tt>deque</tt>
rationale</a>
for details that are not <tt>vector</tt>-specific. </p>
</blockquote>

<p>
-2- A <tt>vector</tt> satisfies all of the requirements of a container and of a
reversible container (given in two tables in
<a
href="lib-containers.html#lib.container.requirements">lib.container.requirements</a>)
and of a sequence, including most of the optional sequence requirements
(<a href="lib-containers.html#lib.sequence.reqmts">lib.sequence.reqmts</a>).
The exceptions are the <tt>push_front</tt> and <tt>pop_front</tt> member
functions, which are not provided. Descriptions are provided here only for
operations on <tt>vector</tt> that are not described in one of these tables or
for operations where there is additional semantic information.
</p>

<blockquote><pre>
namespace std {
  template &lt;class T, class Allocator = allocator&lt;T&gt; &gt;
  class vector {
  public:
    //<i>  types:</i>
    typedef typename Allocator::reference         reference;
    typedef typename Allocator::const_reference   const_reference;
    typedef <b>implementation defined</b>                iterator;       //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                const_iterator; //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                size_type;      //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                difference_type;//<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef T                                     value_type;
    typedef Allocator                             allocator_type;
    typedef typename Allocator::pointer           pointer;
    typedef typename Allocator::const_pointer     const_pointer
    typedef std::reverse_iterator&lt;iterator&gt;       reverse_iterator;
    typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;

    //<i>  <a href="lib-containers.html#lib.vector.cons">lib.vector.cons</a> construct/copy/destroy:</i>
    explicit vector(const Allocator&amp; = Allocator());
    <ins>explicit vector(size_type n);</ins>
    <del>explicit </del>vector(size_type n, const T&amp; value<del> = T()</del>,
        const Allocator&amp; = Allocator());
    template &lt;class InputIterator&gt;
      vector(InputIterator first, InputIterator last,
        const Allocator&amp; = Allocator());
    vector(const vector<del>&lt;T,Allocator&gt;</del>&amp; x);
    <ins>vector(vector&amp;&amp;);</ins>
   ~vector();
    vector<del>&lt;T,Allocator&gt;</del>&amp; operator=(const vector<del>&lt;T,Allocator&gt;</del>&amp; x);
    <ins>vector&amp; operator=(vector&amp;&amp;);</ins>
    template &lt;class InputIterator&gt;
      void assign(InputIterator first, InputIterator last);
    void assign(size_type n, const T&amp; u);
    allocator_type get_allocator() const;

    //<i>  iterators:</i>
    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;

    //<i>  <a href="lib-containers.html#lib.vector.capacity">lib.vector.capacity</a> capacity:</i>
    size_type size() const;
    size_type max_size() const;
    <ins>void      resize(size_type sz);</ins>
    void      resize(size_type sz, T c<del> = T()</del>);
    size_type capacity() const;
    bool      empty() const;
    void      reserve(size_type n);

    //<i>  element access:</i>
    reference       operator[](size_type n);
    const_reference operator[](size_type n) const;
    const_reference at(size_type n) const;
    reference       at(size_type n);
    reference       front();
    const_reference front() const;
    reference       back();
    const_reference back() const;

    //<i>  <a href="lib-containers.html#lib.vector.modifiers">lib.vector.modifiers</a> modifiers:</i>
    void push_back(const T&amp; x);
    <ins>void push_back(T&amp;&amp; x);</ins>
    void pop_back();
    iterator insert(iterator position, const T&amp; x);
    <ins>iterator insert(iterator position, T&amp;&amp; x);</ins>
    void     insert(iterator position, size_type n, const T&amp; x);
    template &lt;class InputIterator&gt;
        void insert(iterator position,
                    InputIterator first, InputIterator last);
    iterator erase(iterator position);
    iterator erase(iterator first, iterator last);
    void     swap(vector<del>&lt;T,Allocator&gt;</del>&amp;<ins>&amp;</ins>);
    void     clear();
  };

  template &lt;class T, class Allocator&gt;
    bool operator==(const vector&lt;T,Allocator&gt;&amp; x,
                    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&lt; (const vector&lt;T,Allocator&gt;&amp; x,
                    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator!=(const vector&lt;T,Allocator&gt;&amp; x,
                    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&gt; (const vector&lt;T,Allocator&gt;&amp; x,
                    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&gt;=(const vector&lt;T,Allocator&gt;&amp; x,
                    const vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    bool operator&lt;=(const vector&lt;T,Allocator&gt;&amp; x,
                    const vector&lt;T,Allocator&gt;&amp; y);

  //<i>  specialized algorithms:</i>
  template &lt;class T, class Allocator&gt;
    void swap(vector&lt;T,Allocator&gt;&amp; x, vector&lt;T,Allocator&gt;&amp; y);
  <ins>template &lt;class T, class Allocator&gt;
    void swap(vector&lt;T,Allocator&gt;&amp;&amp; x, vector&lt;T,Allocator&gt;&amp; y);
  template &lt;class T, class Allocator&gt;
    void swap(vector&lt;T,Allocator&gt;&amp; x, vector&lt;T,Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="23.2.4.1 - vector constructors, copy, and assignment"></a>23.2.4.1 - <tt>vector</tt> constructors, copy, and assignment</h4>

<blockquote><pre><ins>
vector(const Allocator&amp; = Allocator());
</ins></pre></blockquote>

<p><ins>
-1- <b>Effects:</b> Constructs an empty <tt>vector</tt>, using the specified
allocator.
</ins></p>

<p><ins>
-2- <b>Complexity:</b> Constant.
</ins></p>

<blockquote><pre><ins>
explicit vector(size_type n);
</ins></pre></blockquote>

<p><ins>
-3- <b>Effects:</b> Constructs a <tt>vector</tt> with <tt>n</tt> default
constructed elements. [<i>Note:</i> Requires <tt>T</tt> to be default
constructible. <i>--end note</i>]
</ins></p>

<p><ins>
-4- <b>Complexity:</b> Linear in <tt>n</tt>.
</ins></p>

<blockquote><pre><ins>
vector(size_type n, const T&amp; value,
       const Allocator&amp; = Allocator());
</ins></pre></blockquote>

<p><ins>
-5- <b>Effects:</b> Constructs a <tt>vector</tt> with <tt>n</tt> copies of
<tt>value</tt>, using the specified allocator.
</ins></p>

<p><ins>
-6- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt>.
</ins></p>

<p><ins>
-7- <b>Complexity:</b> Linear in <tt>n</tt>.
</ins></p>

<blockquote><pre>
<del>vector(const Allocator&amp; = Allocator());</del>
<del>explicit vector(size_type n, const T&amp; value = T(),
                const Allocator&amp; = Allocator());</del>
template &lt;class InputIterator&gt;
  vector(InputIterator first, InputIterator last,
         const Allocator&amp; = Allocator());
<del>vector(const vector&lt;T,Allocator&gt;&amp; x);</del>
</pre></blockquote>

<p><ins>
-8- <b>Effects:</b> Constructs a <tt>vector</tt> equal to the the range
<tt>[first, last)</tt>, using the specified allocator.  Each iterator in the
range <tt>[first, last)</tt> is dereferenced exactly once.
</ins></p>

<p><ins>
-9- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt> only if the
dereferenced <tt>InputIterator</tt> returns an lvalue or const rvalue.
</ins></p>

<p>
-10- <b>Complexity:</b> <del>The constructor
<tt>template &lt;class InputIterator&gt; vector(InputIterator first,
InputIterator last)</tt> m</del><ins>M</ins>akes only <tt>N</tt> calls to the
copy constructor of <tt>T</tt> (where <tt>N</tt> is the distance between
<tt>first</tt> and <tt>last</tt>) and no reallocations if iterators first and
last are of forward, bidirectional, or random access categories. It makes order
<tt>N</tt> calls to the copy constructor of <tt>T</tt> and order <tt>logN</tt>
reallocations if they are just input iterators.
</p>

<blockquote><pre>
template &lt;class InputIterator&gt;
  void assign(InputIterator first, InputIterator last);
</pre></blockquote>

<p>
-11- <b>Effects:</b>
</p>

<blockquote><pre>
  erase(begin(), end());
  insert(begin(), first, last);
</pre></blockquote>

<p><ins>
Each iterator in the range <tt>[first, last)</tt> is dereferenced exactly once.
</ins></p>

<p><ins>
-12- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt> and
<tt>CopyAssignable</tt> only if the dereferenced <tt>InputIterator</tt> returns
an lvalue or const rvalue.
</ins></p>

<blockquote><pre>
void assign(size_type n, const T&amp; t);
</pre></blockquote>

<p>
-13- <b>Effects:</b>
</p>

<blockquote><pre>
  erase(begin(), end());
  insert(begin(), n, t);
</pre></blockquote>

<p><ins>
-14- Requires: <tt>T</tt> must be <tt>CopyConstructible</tt> and
<tt>CopyAssignable</tt>.
</ins></p>

<h4><a name="23.2.4.2 - vector capacity"></a>23.2.4.2 - <tt>vector</tt> capacity</h4>

<blockquote class="note">
<p>
A nothrow requirement is placed on the move constructor of <tt>value_type</tt>
when <tt>reserve</tt> is called.  This is required if <tt>reserve</tt> is to
offer the strong exception guarantee.  Currently the standard does not require
roll back semantics for <tt>reserve</tt>.  However implementations do offer this
guarantee (and it is added here) and implementations would be unable to comply
in the presence of a throwing move constructor. </p>

<p>
There is also a nothrow requirement for the <tt>value_type</tt>'s move
constructor added to <tt>resize</tt> (both overloads). </p>
</blockquote>

<blockquote><pre>
void reserve(size_type n);
</pre></blockquote>

<p><ins>
-2- <b>Requires:</b>  The <tt>value_type</tt>'s move constructor (if it exists)
must not throw an exception.
</ins></p>

<p>
-3- <b>Effects:</b> A directive that informs a <tt>vector</tt>
of a planned change in size, so that it can manage the storage allocation
accordingly. After <tt>reserve()</tt>, <tt>capacity()</tt> is greater or equal
to the argument of <tt>reserve</tt> if reallocation happens; and equal to the
previous value of <tt>capacity()</tt> otherwise. Reallocation happens at this
point if and only if the current capacity is less than the argument of
<tt>reserve()</tt>.
</p>

<p>
-4- <b>Complexity:</b> It does not change the size of the sequence and takes at
most linear time in the size of the sequence.
</p>

<p>
-5- <b>Throws:</b> <tt>length_error</tt> if <tt><tt><i>n</i></tt> &gt;
max_size()</tt>.* <ins>If an exception is thrown, there are no effects.</ins>
</p>

<blockquote>
[Footnote: <tt>reserve()</tt> uses <tt>Allocator::allocate()</tt> which may
throw an appropriate exception. --- end foonote]
</blockquote>

<p>
-6- <b>Remarks:</b> Reallocation invalidates all the references, pointers, and
iterators referring to the elements in the sequence. It is guaranteed that no
reallocation takes place during insertions that happen after a call to
<tt>reserve()</tt> until the time when an insertion would make the size of the
vector greater than the size specified in the most recent call to
<tt>reserve()</tt>.
</p>

<blockquote><pre>
void swap(vector<del>&lt;T, Allocator&gt;</del>&amp;<ins>&amp;</ins> x);
</pre></blockquote>

<p>
-7- <b>Effects:</b> Exchanges the contents and <tt>capacity()</tt> of
<tt>*this</tt> with that of <tt>x</tt>.
</p>

<p>
-8- <b>Complexity:</b> Constant time.
</p>

<blockquote><pre><ins>
void resize(size_type sz);
</ins></pre></blockquote>

<p><ins>
-9- <b>Effects:</b> If <tt>sz</tt> is less than <tt>size()</tt> then <tt>size()
- sz</tt> elements are erased from the end of the sequence.  Else <tt>sz -
size()</tt> default constructed elements are appended to the sequence.
</ins></p>

<p><ins>
-10- <b>Requires:</b> <tt>T</tt> must be default constructible.
The <tt>value_type</tt>'s move constructor (if it exists) must not throw an
exception.
</ins></p>

<blockquote><pre>
void resize(size_type sz, T c<del> = T()</del>);
</pre></blockquote>

<p>
-11- <b>Effects:</b>
</p>

<blockquote><pre>
  if (sz &gt; size())
    insert(end(), sz-size(), c);
  else if (sz &lt; size())
    erase(begin()+sz, end());
  else
    ;                           // <i>  do nothing</i>
</pre></blockquote>

<p><ins>
-12- <b>Requires:</b> <tt>T</tt> must be <tt>CopyConstructible</tt>.
The <tt>value_type</tt>'s move constructor (if it exists) must not throw an
exception.
</ins></p>

<h4><a name="23.2.4.3 - vector modifiers"></a>23.2.4.3 - <tt>vector</tt> modifiers</h4>

<blockquote class="note">
<p>
In order to comply with the current exception safety guarantees, the
<tt>value_type</tt>'s move constructor must not throw an exception during
<tt>push_back</tt> or <tt>insert</tt>. </p>
</blockquote>

<blockquote><pre><ins>
void push_back(const T&amp; x);
void push_back(T&amp;&amp; x);
</ins></pre></blockquote>

<p><ins>
-1- <b>Effects:</b> Appends a copy of <tt>x</tt> to the end of the sequence.
</ins></p>

<p><ins>
-2- <b>Requires:</b> The signature with a <tt>const T&amp;</tt> parameter
requires <tt>T</tt> to be <tt>CopyConstructible</tt>.  The <tt>value_type</tt>'s
move constructor (if it exists) must not throw an exception.
</ins></p>

<blockquote><pre>
iterator insert(iterator position, const T&amp; x);
<ins>iterator insert(iterator position, T&amp;&amp; x);</ins>
void     insert(iterator position, size_type n, const T&amp; x);
template &lt;class InputIterator&gt;
  void insert(iterator position, InputIterator first, InputIterator last);
</pre></blockquote>

<p>
-3- <b>Remarks:</b> Causes reallocation if the new size is greater than the old
capacity. If no reallocation happens, all the iterators and references before
the insertion point remain valid.  If an exception is thrown other than by the
copy constructor or assignment operator of <tt>T</tt> there are no effects.
<ins>Each iterator in the range <tt>[first, last)</tt> is dereferenced exactly
once.</ins>
</p>

<p><ins>
-4- <b>Requires:</b> The signatures taking a <tt>const T&</tt> parameter
require <tt>T</tt> to be <tt>CopyConstructible</tt> and <tt>CopyAssignable</tt>.
The signature taking <tt>InputIterator</tt> parameters requires <tt>T</tt> to be
<tt>CopyConstructible</tt> and <tt>CopyAssignable</tt> only if the dereferenced
<tt>InputIterator</tt> returns an lvalue or const rvalue.  The
<tt>value_type</tt>'s move constructor (if it exists) must not throw an
exception.
</ins></p>

<p>
-5- <b>Complexity:</b> If <tt>first</tt> and <tt>last</tt> are forward
iterators, bidirectional iterators, or random access iterators, the complexity
is linear in the number of elements in the range <tt>[first, last)</tt> plus the
distance to the end of the vector. If they are input iterators, the complexity
is proportional to the number of elements in the range <tt>[first, last)</tt>
times the distance to the end of the vector.
</p>

<blockquote><pre>
iterator erase(iterator position);
iterator erase(iterator first, iterator last);
</pre></blockquote>

<p>
-6- <b>Effects:</b> Invalidates all the iterators and references after the point
of the erase.
</p>

<p>
-7- <b>Complexity:</b> The destructor of <tt>T</tt> is called the number of
times equal to the number of the elements erased, but the <ins>move</ins>
assignment operator of <tt>T</tt> is called the number of times equal to the
number of elements in the vector after the erased elements.
</p>

<p>
-8- <b>Throws:</b> Nothing unless an exception is thrown by the
copy constructor or assignment operator of <tt>T</tt>.
</p>

<h4><a name="23.2.4.4 - vector specialized algorithms"></a>23.2.4.4 - <tt>vector</tt> specialized algorithms</h4>

<blockquote><pre>
template &lt;class T, class Allocator&gt;
  void swap(vector&lt;T,Allocator&gt;&amp; x, vector&lt;T,Allocator&gt;&amp; y);
<ins>template &lt;class T, class Allocator&gt;
  void swap(vector&lt;T,Allocator&gt;&amp;&amp; x, vector&lt;T,Allocator&gt;&amp; y);
template &lt;class T, class Allocator&gt;
  void swap(vector&lt;T,Allocator&gt;&amp; x, vector&lt;T,Allocator&gt;&amp;&amp; y);</ins>
</pre></blockquote>

<p>
-1- <b>Effects:</b>
</p>

<blockquote><pre>
  x.swap(y);
</pre></blockquote>

<h3><a name="23.2.5 - Class template vector&lt;bool&gt;"></a>23.2.5 - Class template <tt>vector&lt;bool&gt;</tt></h3>

<blockquote class="note">
<p>
The changes required for <tt>vector&lt;bool&gt;</tt> are minimal because
<tt>vector&lt;bool&gt;::value_type</tt> copies with the same efficiency as it
moves! </p>
</blockquote>

<p>
-1- To optimize space allocation, a specialization of vector for <tt>bool</tt>
elements is provided:
</p>

<blockquote><pre>
namespace std {
  template &lt;class Allocator&gt; class vector&lt;bool, Allocator&gt; {
  public:
    //<i>  types:</i>
    typedef bool                                  const_reference;
    typedef <b>implementation defined</b>                iterator;       //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                const_iterator; //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                size_type;      //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                difference_type;//<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef bool                                  value_type;
    typedef Allocator                             allocator_type;
    typedef <b>implementation defined</b>                pointer;
    typedef <b>implementation defined</b>                const_pointer
    typedef std::reverse_iterator&lt;iterator&gt;       reverse_iterator;
    typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;

    //<i>  bit reference:</i>
    class reference {
     friend class vector;
     reference();
    public:
     ~reference();
      operator bool() const;
      reference&amp; operator=(const bool x);
      reference&amp; operator=(const reference&amp; x);
      void flip();              //<i>  flips the bit</i>
    };

    //<i>  construct/copy/destroy:</i>
    explicit vector(const Allocator&amp; = Allocator());
    explicit vector(size_type n, const bool&amp; value = bool(),
                    const Allocator&amp; = Allocator());
    template &lt;class InputIterator&gt;
      vector(InputIterator first, InputIterator last,
        const Allocator&amp; = Allocator());
    vector(const vector<del>&lt;bool,Allocator&gt;</del>&amp; x);
    <ins>vector(vector&amp;&amp; x);</ins>
   ~vector();
    vector<del>&lt;bool,Allocator&gt;</del>&amp; operator=(const vector<del>&lt;bool,Allocator&gt;</del>&amp; x);
    <ins>vector&amp; operator=(vector&amp;&amp; x);</ins>
    template &lt;class InputIterator&gt;
      void assign(InputIterator first, InputIterator last);
    void assign(size_type n, const T&amp; t);
    allocator_type get_allocator() const;

    //<i>  iterators:</i>
    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;

    //<i>  capacity:</i>
    size_type size() const;
    size_type max_size() const;
    void      resize(size_type sz, bool c = false);
    size_type capacity() const;
    bool      empty() const;
    void      reserve(size_type n);

    //<i>  element access:</i>
    reference       operator[](size_type n);
    const_reference operator[](size_type n) const;
    const_reference at(size_type n) const;
    reference       at(size_type n);
    reference       front();
    const_reference front() const;
    reference       back();
    const_reference back() const;

    //<i>  modifiers:</i>
    void push_back(const bool&amp; x);
    void pop_back();
    iterator insert(iterator position, const bool&amp; x);
    void     insert (iterator position, size_type n, const bool&amp; x);
    template &lt;class InputIterator&gt;
        void insert(iterator position,
                    InputIterator first, InputIterator last);

    iterator erase(iterator position);
    iterator erase(iterator first, iterator last);
    void swap(vector<del>&lt;bool,Allocator&gt;</del>&amp;<ins>&amp;</ins>);
    static void swap(reference x, reference y);
    void flip();                //<i>  flips all bits</i>
    void clear();
  };

  <del>//<i>  specialized algorithms:</i>
  template &lt;class Allocator&gt;
    void swap(vector&lt;bool,Allocator&gt;&amp; x, vector&lt;bool,Allocator&gt;&amp; y);</del>
}
</pre></blockquote>

<p>
-2- <tt>reference</tt> is a class that simulates the behavior of references of a
single bit in <tt>vector&lt;bool&gt;</tt>.
</p>

<h2><a name="23.3 - Associative containers"></a>23.3 - Associative containers</h2>

<p>
-1- Headers <tt>&lt;map&gt;</tt> and <tt>&lt;set&gt;</tt>:
</p>

<p>
<b>Header <tt>&lt;map&gt;</tt> synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class Key, class T, class Compare = less&lt;Key&gt;,
            class Allocator = allocator&lt;pair&lt;const Key, T&gt; &gt; &gt;
    class map;
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator==(const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&lt; (const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator!=(const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&gt; (const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&gt;=(const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&lt;=(const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(map&lt;Key,T,Compare,Allocator&gt;&amp; x,
              map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  <ins>template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(map&lt;Key,T,Compare,Allocator&gt;&amp;&amp; x,
              map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(map&lt;Key,T,Compare,Allocator&gt;&amp; x,
              map&lt;Key,T,Compare,Allocator&gt;&amp;&amp; y);</ins>

  template &lt;class Key, class T, class Compare = less&lt;Key&gt;,
            class Allocator = allocator&lt;pair&lt;const Key, T&gt; &gt; &gt;
    class multimap;
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator==(const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&lt; (const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator!=(const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&gt; (const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&gt;=(const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&lt;=(const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
              multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  <ins>template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(multimap&lt;Key,T,Compare,Allocator&gt;&amp;&amp; x,
              multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
              multimap&lt;Key,T,Compare,Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<p>
<b>Header <tt>&lt;set&gt;</tt> synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class Key, class Compare = less&lt;Key&gt;,
            class Allocator = allocator&lt;Key&gt; &gt;
    class set;
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator==(const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&lt; (const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator!=(const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&gt; (const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&gt;=(const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&lt;=(const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    void swap(set&lt;Key,Compare,Allocator&gt;&amp; x,
              set&lt;Key,Compare,Allocator&gt;&amp; y);
  <ins>template &lt;class Key, class Compare, class Allocator&gt;
    void swap(set&lt;Key,Compare,Allocator&gt;&amp;&amp; x,
              set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    void swap(set&lt;Key,Compare,Allocator&gt;&amp; x,
              set&lt;Key,Compare,Allocator&gt;&amp;&amp; y);</ins>

  template &lt;class Key, class Compare = less&lt;Key&gt;,
            class Allocator = allocator&lt;Key&gt; &gt;
    class multiset;
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator==(const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&lt; (const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator!=(const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&gt; (const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&gt;=(const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&lt;=(const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    void swap(multiset&lt;Key,Compare,Allocator&gt;&amp; x,
              multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  <ins>template &lt;class Key, class Compare, class Allocator&gt;
    void swap(multiset&lt;Key,Compare,Allocator&gt;&amp;&amp; x,
              multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    void swap(multiset&lt;Key,Compare,Allocator&gt;&amp; x,
              multiset&lt;Key,Compare,Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h3><a name="23.3.1 - Class template map"></a>23.3.1 - Class template <tt>map</tt></h3>

<blockquote class="note">
<p>
Most of the rationale for the changes to <tt>map</tt> is the same as for
<tt>deque</tt>.
Please refer to the <a href="#23.2.1 - Class template deque"><tt>deque</tt>
rationale</a>
for details that are not <tt>map</tt>-specific. </p>
</blockquote>

<p>-2- A <tt>map</tt> satisfies all of the requirements of a container and of a
reversible container
(<a
href="lib-containers.html#lib.container.requirements">lib.container.requirements</a>)
and of an associative container
(<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>).
A <tt>map</tt> also provides most operations described in
(<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>)
for unique keys. This means that a <tt>map</tt> supports the <tt>a_uniq</tt>
operations in (<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>)
but not the <tt>a_eq</tt> operations. For a <tt>map&lt;Key,T&gt;</tt> the
<tt>key_type</tt> is <tt>Key</tt> and the <tt>value_type</tt> is
<tt>pair&lt;const Key,T&gt;</tt>. Descriptions are provided here only for
operations on <tt>map</tt> that are not described in one of those tables or for
operations where there is additional semantic information.
</p>

<blockquote><pre>
namespace std {
  template &lt;class Key, class T, class Compare = less&lt;Key&gt;,
            class Allocator = allocator&lt;pair&lt;const Key, T&gt; &gt; &gt;
  class map {
  public:
    //<i>  types:</i>
    typedef Key                                   key_type;
    typedef T                                     mapped_type;
    typedef pair&lt;const Key, T&gt;                    value_type;
    typedef Compare                               key_compare;
    typedef Allocator                             allocator_type;
    typedef typename Allocator::reference         reference;
    typedef typename Allocator::const_reference   const_reference;
    typedef <b>implementation defined</b>                iterator;       //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                const_iterator; //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                size_type;      //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                difference_type;//<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef typename Allocator::pointer           pointer;
    typedef typename Allocator::const_pointer     const_pointer;
    typedef std::reverse_iterator&lt;iterator&gt;       reverse_iterator;
    typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;

    class value_compare
      : public binary_function&lt;value_type,value_type,bool&gt; {
    friend class map;
    protected:
      Compare comp;
      value_compare(Compare c) : comp(c) {}
    public:
      bool operator()(const value_type&amp; x, const value_type&amp; y) const {
        return comp(x.first, y.first);
      }
    };

    //<i>  <a href="lib-containers.html#lib.map.cons">lib.map.cons</a> construct/copy/destroy:</i>
    explicit map(const Compare&amp; comp = Compare(),
                 const Allocator&amp; = Allocator());
    template &lt;class InputIterator&gt;
      map(InputIterator first, InputIterator last,
          const Compare&amp; comp = Compare(), const Allocator&amp; = Allocator());
    map(const map<del>&lt;Key,T,Compare,Allocator&gt;</del>&amp; x);
    <ins>map(map&amp;&amp; x);</ins>
   ~map();
    map<del>&lt;Key,T,Compare,Allocator&gt;</del>&amp;
      operator=(const map<del>&lt;Key,T,Compare,Allocator&gt;</del>&amp; x);
    <ins>map&amp; operator=(map&amp;&amp; x);</ins>
    allocator_type get_allocator() const;

    //<i>  iterators:</i>
    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;

    //<i>  capacity:</i>
    bool      empty() const;
    size_type size() const;
    size_type max_size() const;

    //<i>  <a href="lib-containers.html#lib.map.access">lib.map.access</a> element access:</i>
    T&amp; operator[](const key_type&amp; x);
    <ins>T&amp; operator[](key_type&amp;&amp; x);</ins>

    //<i>  modifiers:</i>
    pair&lt;iterator, bool&gt; insert(const value_type&amp; x);
    <ins>template &lt;class P&gt; pair&lt;iterator, bool&gt; insert(P&amp;&amp; x);</ins>
    iterator             insert(iterator position, const value_type&amp; x);
    <ins>template &lt;class P&gt; iterator insert(iterator position, P&amp;&amp; x);</ins>
    template &lt;class InputIterator&gt;
      void insert(InputIterator first, InputIterator last);

    void      erase(iterator position);
    size_type erase(const key_type&amp; x);
    void      erase(iterator first, iterator last);
    void swap(map<del>&lt;Key,T,Compare,Allocator&gt;</del>&amp;<ins>&amp;</ins>);
    void clear();

    //<i>  observers:</i>
    key_compare   key_comp() const;
    value_compare value_comp() const;

    //<i>  <a href="lib-containers.html#lib.map.ops">lib.map.ops</a> map operations:</i>
    iterator       find(const key_type&amp; x);
    const_iterator find(const key_type&amp; x) const;
    size_type      count(const key_type&amp; x) const;

    iterator       lower_bound(const key_type&amp; x);
    const_iterator lower_bound(const key_type&amp; x) const;
    iterator       upper_bound(const key_type&amp; x);
    const_iterator upper_bound(const key_type&amp; x) const;

    pair&lt;iterator,iterator&gt;
        equal_range(const key_type&amp; x);
    pair&lt;const_iterator,const_iterator&gt;
        equal_range(const key_type&amp; x) const;
  };

  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator==(const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&lt; (const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator!=(const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&gt; (const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&gt;=(const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&lt;=(const map&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const map&lt;Key,T,Compare,Allocator&gt;&amp; y);

  //<i>  specialized algorithms:</i>
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(map&lt;Key,T,Compare,Allocator&gt;&amp; x,
              map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  <ins>template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(map&lt;Key,T,Compare,Allocator&gt;&amp;&amp; x,
              map&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(map&lt;Key,T,Compare,Allocator&gt;&amp; x,
              map&lt;Key,T,Compare,Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="23.3.1.1 - map constructors, copy, and assignment"></a>23.3.1.1 - <tt>map</tt> constructors, copy, and assignment</h4>

<blockquote><pre>
template &lt;class InputIterator&gt;
  map(InputIterator <tt><i>first</i></tt>, InputIterator <tt><i>last</i></tt>,
      const Compare&amp; <tt><i>comp</i></tt> = Compare(), const Allocator&amp; = Allocator());
</pre></blockquote>

<p><ins>
-3- <b>Requires:</b> Does not require <tt>CopyConstructible</tt> of either
<tt>key_type</tt> or <tt>mapped_type</tt> if the dereferenced
<tt>InputIterator</tt> returns a non-const rvalue
<tt>pair&lt;key_type,mapped_type&gt;</tt>. Otherwise <tt>CopyConstructible</tt>
is required for both <tt>key_type</tt> and <tt>mapped_type</tt>.
</ins></p>

<p>
-4- <b>Effects:</b> Constructs an empty <tt>map</tt> using the specified
comparison object and allocator, and inserts elements from the range
<tt>[<i>first</i>, <i>last</i>)</tt>.
</p>

<p>
-5- <b>Complexity:</b> Linear in <tt><i>N</i></tt> if the range
<tt>[<i>first</i>, <i>last</i>)</tt> is already sorted using
<tt><i>comp</i></tt> and otherwise <tt><i>N log N</i></tt>, where
<tt><i>N</i></tt> is <tt><i>last</i></tt> - <tt><i>first</i></tt>.
</p>

<h4><a name="23.3.1.2 - map element access"></a>23.3.1.2 - <tt>map</tt> element access</h4>

<blockquote class="note">
<p>
A <tt>operator[]</tt> overload has been added that accepts rvalue
<tt>key_type</tt>s.  This allows heavy and/or non-copyable <tt>key_type</tt>s to
be added to the <tt>map</tt> using <tt>operator[]</tt>. </p>
</blockquote>

<blockquote><pre>
T&amp; operator[](const key_type&amp; x);
</pre></blockquote>

<p>
-1- <b>Effects:</b> If there is no key equivalent to <tt>x</tt> in the map,
inserts <tt>value_type(x, T())</tt> into the map.
</p>

<p><ins>
-2- <b>Requires:</b> <tt>key_type</tt> must be <tt>CopyConstructible</tt>.
<tt>mapped_type</tt> must be default constructible.
</ins></p>

<p>
-3- <b>Returns:</b> A reference to the <tt>mapped_type</tt> corresponding to
<tt>x</tt> in <tt>*this</tt>.
</p>

<p>
-4- <b>Complexity:</b> logarithmic.
</p>

<blockquote><pre><ins>
T&amp; operator[](key_type&amp;&amp; x);
</ins></pre></blockquote>

<p><ins>
-5- <b>Requires:</b> <tt>mapped_type</tt> must be default constructible.
</ins></p>

<p>
-6- <b>Effects:</b> If there is no key equivalent to <tt>x</tt> in the map,
inserts <tt>value_type(std::move(x), T())</tt> into the map (without requiring
<tt>x</tt> to be <tt>CopyConstructible</tt>).
</p>

<p>
-7- <b>Returns:</b> A reference to the <tt>mapped_type</tt> corresponding to
<tt>x</tt> in <tt>*this</tt>.
</p>

<p>
-8- <b>Complexity:</b> logarithmic.
</p>

<h4><a name="23.3.1.3 - map modifiers"></a>23.3.1.3 - <tt>map</tt> modifiers</h4>

<blockquote class="note">
Two of the <tt>insert</tt> signatures are new.  They have been added to allow
moving from rvalue types other than <tt>value_type</tt>, which are convertible
to <tt>value_type</tt>.  When <tt>P</tt> instantiates as an lvalue, the argument
is copied into the <tt>map</tt>, else it is moved into the <tt>map</tt> (const
qualifiers permitting).
</blockquote>

<blockquote><pre><ins>
pair&lt;iterator, bool&gt; insert(const value_type&amp; x);
template &lt;class P&gt; pair&lt;iterator, bool&gt; insert(P&amp;&amp; x);
iterator             insert(iterator position, const value_type&amp; x);
template &lt;class P&gt; iterator insert(iterator position, P&amp;&amp; x);
template &lt;class InputIterator&gt;
  void insert(InputIterator first, InputIterator last);
</ins></pre></blockquote>

<p><ins>
-1- <b>Requires:</b> Those signatures taking a <tt>const value_type&amp;</tt>
parameter requires both the <tt>key_type</tt> and the <tt>mapped_type</tt> to be
<tt>CopyConstructible</tt>.  The signatures taking a <tt>P&amp;&amp;</tt>
parameter require <tt>P</tt> to be convertible to <tt>value_type</tt>.  If
<tt>P</tt> is instantiated as a <tt>reference</tt> type, then the argument
<tt>x</tt> is copied from.  Otherwise <tt>x</tt> is considered to be an rvalue
as it is converted to <tt>value_type</tt> and inserted into the <tt>map</tt>.
Specifically, in such cases <tt>CopyConstructible</tt> is not required of
<tt>key_type</tt> or <tt>mapped_type</tt> unless the conversion from <tt>P</tt>
specifically requires it (e.g. if <tt>P</tt> is a <tt>tuple&lt;const key_type,
mapped_type&gt</tt>, then <tt>key_type</tt> must be <tt>CopyConstructible</tt>).
The signature taking <tt>InputIterator</tt> parameters does not require
<tt>CopyConstructible</tt> of either <tt>key_type</tt> or <tt>mapped_type</tt>
if the dereferenced <tt>InputIterator</tt> returns a non-const rvalue
<tt>pair&lt;key_type,mapped_type&gt;</tt>. Otherwise <tt>CopyConstructible</tt>
is required for both <tt>key_type</tt> and <tt>mapped_type</tt>.
</ins></p>

<h4><a name="23.3.1.4 - map operations"></a>23.3.1.<del>3</del><ins>4</ins> - <tt>map</tt> operations</h4>

<blockquote><pre>
iterator       find(const key_type&amp; x);
const_iterator find(const key_type&amp; x) const;

iterator       lower_bound(const key_type&amp; x);
const_iterator lower_bound(const key_type&amp; x) const;

iterator       upper_bound(const key_type&amp; x);
const_iterator upper_bound(const key_type &amp;x) const;

pair&lt;iterator, iterator&gt;
  equal_range(const_key_type &amp;x);
pair&lt;const_iterator, const_iterator&gt;
  equal_range(const key_type&amp; x) const;
</pre></blockquote>

<p>
-1- The <tt>find</tt>, <tt>lower_bound</tt>, <tt>upper_bound</tt> and
<tt>equal_range</tt> member functions each have two versions, one const and the
other non-const. In each case the behavior of the two functions is identical
except that the const version returns a <tt>const_iterator</tt> and the
non-const version an <tt>iterator</tt>
(<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>).
</p>

<h4><a name="23.3.1.5 - map specialized algorithms"></a>23.3.1.<del>4</del><ins>5</ins> - <tt>map</tt> specialized algorithms</h4>

<blockquote><pre>
template &lt;class Key, class T, class Compare, class Allocator&gt;
  void swap(map&lt;Key,T,Compare,Allocator&gt;&amp; x,
            map&lt;Key,T,Compare,Allocator&gt;&amp; y);
<ins>template &lt;class Key, class T, class Compare, class Allocator&gt;
  void swap(map&lt;Key,T,Compare,Allocator&gt;&amp;&amp; x,
            map&lt;Key,T,Compare,Allocator&gt;&amp; y);
template &lt;class Key, class T, class Compare, class Allocator&gt;
  void swap(map&lt;Key,T,Compare,Allocator&gt;&amp; x,
            map&lt;Key,T,Compare,Allocator&gt;&amp;&amp; y);</ins>
</pre></blockquote>

<p>
-1- <b>Effects:</b>
</p>

<blockquote><pre>
  x.swap(y);
</pre></blockquote>

<h3><a name="23.3.2 - Class template multimap"></a>23.3.2 - Class template <tt>multimap</tt></h3>

<blockquote class="note">
<p>
See the <a href="#23.3.1 - Class template map"><tt>map</tt> description</a>
for rationale. </p>
</blockquote>

<p>
-2- A <tt>multimap</tt> satisfies all of the requirements of a container and of
a reversible container
(<a
href="lib-containers.html#lib.container.requirements">lib.container.requirements</a>)
and of an associative container
(<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>).
A <tt>multimap</tt> also provides most operations described in
(<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>)
for equal keys. This means that a <tt>multimap</tt> supports the <tt>a_eq</tt>
operations in
(<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>)
but not the <tt>a_uniq</tt> operations. For a <tt>multimap&lt;Key,T&gt;</tt> the
<tt>key_type</tt> is <tt>Key</tt> and the <tt>value_type</tt> is
<tt>pair&lt;const Key,T&gt;</tt>. Descriptions are provided here only for
operations on <tt>multimap</tt> that are not described in one of those tables or
for operations where there is additional semantic information.
</p>

<blockquote><pre>
namespace std {
  template &lt;class Key, class T, class Compare = less&lt;Key&gt;,
            class Allocator = allocator&lt;pair&lt;const Key, T&gt; &gt; &gt;
  class multimap {
  public:
    //<i>  types:</i>
    typedef Key                                   key_type;
    typedef T                                     mapped_type;
    typedef pair&lt;const Key,T&gt;                     value_type;
    typedef Compare                               key_compare;
    typedef Allocator                             allocator_type;
    typedef typename Allocator::reference         reference;
    typedef typename Allocator::const_reference   const_reference;
    typedef <b>implementation defined</b>                iterator;       //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                const_iterator; //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                size_type;      //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                difference_type;//<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef typename Allocator::pointer           pointer;
    typedef typename Allocator::const_pointer     const_pointer;
    typedef std::reverse_iterator&lt;iterator&gt;       reverse_iterator;
    typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;

    class value_compare
      : public binary_function&lt;value_type,value_type,bool&gt; {
    friend class multimap;
    protected:
      Compare comp;
      value_compare(Compare c) : comp(c) {}
    public:
      bool operator()(const value_type&amp; x, const value_type&amp; y) const {
        return comp(x.first, y.first);
      }
    };

    //<i>  construct/copy/destroy:</i>
    explicit multimap(const Compare&amp; comp = Compare(),
                      const Allocator&amp; = Allocator());
    template &lt;class InputIterator&gt;
      multimap(InputIterator first, InputIterator last,
               const Compare&amp; comp = Compare(),
               const Allocator&amp; = Allocator());
    multimap(const multimap<del>&lt;Key,T,Compare,Allocator&gt;</del>&amp; x);
    <ins>multimap(multimap&amp;&amp; x);</ins>
   ~multimap();
    multimap<del>&lt;Key,T,Compare,Allocator&gt;</del>&amp;
      operator=(const multimap<del>&lt;Key,T,Compare,Allocator&gt;</del>&amp; x);
    <ins>multimap&amp; operator=(multimap&amp;&amp; x);</ins>
    allocator_type get_allocator() const;

    //<i>  iterators:</i>
    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;

    //<i>  capacity:</i>
    bool           empty() const;
    size_type      size() const;
    size_type      max_size() const;

    //<i>  modifiers:</i>
    iterator insert(const value_type&amp; x);
    <ins>template &lt;class P&gt; iterator insert(P&amp;&amp; x);</ins>
    iterator insert(iterator position, const value_type&amp; x);
    <ins>template &lt;class P&gt; iterator insert(iterator position, P&amp;&amp; x);</ins>
    template &lt;class InputIterator&gt;
      void insert(InputIterator first, InputIterator last);

    void      erase(iterator position);
    size_type erase(const key_type&amp; x);
    void      erase(iterator first, iterator last);
    void swap(multimap<del>&lt;Key,T,Compare,Allocator&gt;</del>&amp;<ins>&amp;</ins>);
    void clear();

    //<i>  observers:</i>
    key_compare    key_comp() const;
    value_compare  value_comp() const;

    //<i>  map operations:</i>
    iterator       find(const key_type&amp; x);
    const_iterator find(const key_type&amp; x) const;
    size_type      count(const key_type&amp; x) const;

    iterator       lower_bound(const key_type&amp; x);
    const_iterator lower_bound(const key_type&amp; x) const;
    iterator       upper_bound(const key_type&amp; x);
    const_iterator upper_bound(const key_type&amp; x) const;

    pair&lt;iterator,iterator&gt;
      equal_range(const key_type&amp; x);
    pair&lt;const_iterator,const_iterator&gt;
      equal_range(const key_type&amp; x) const;
  };

  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator==(const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&lt; (const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator!=(const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&gt; (const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&gt;=(const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    bool operator&lt;=(const multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
                    const multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);

  //<i>  specialized algorithms:</i>
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
              multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  <ins>template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(multimap&lt;Key,T,Compare,Allocator&gt;&amp;&amp; x,
              multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class T, class Compare, class Allocator&gt;
    void swap(multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
              multimap&lt;Key,T,Compare,Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="23.3.2.1 - multimap constructors, copy, and assignment"></a>23.3.1.1 - <tt>multimap</tt> constructors, copy, and assignment</h4>

<blockquote><pre>
template &lt;class InputIterator&gt;
  multimap(InputIterator <tt><i>first</i></tt>, InputIterator <tt><i>last</i></tt>,
           const Compare&amp; comp = Compare(),
           const Allocator&amp; = Allocator()0;
</pre></blockquote>

<p><ins>
-3- <b>Requires:</b> Does not require <tt>CopyConstructible</tt> of either
<tt>key_type</tt> or <tt>mapped_type</tt> if the dereferenced
<tt>InputIterator</tt> returns a non-const rvalue
<tt>pair&lt;key_type,mapped_type&gt;</tt>. Otherwise <tt>CopyConstructible</tt>
is required for both <tt>key_type</tt> and <tt>mapped_type</tt>.
</ins></p>

<p>
-4- <b>Effects:</b> Constructs an empty <tt>multimap</tt> using the specified
comparison object and allocator, and inserts elements from the range
<tt>[<i>first</i>, <i>last</i>)</tt>.
</p>

<p>
-5- <b>Complexity:</b> Linear in <tt><i>N</i></tt> if the range
<tt>[<i>first</i>, <i>last</i>)</tt>. is already sorted using
<tt><i>comp</i></tt> and otherwise <tt><i>N log N</i></tt>, where
<tt><i>N</i></tt> is <tt><i>last</i> - <i>first</i></tt>.
</p>

<h4><a name="23.3.2.2 - multimap modifiers"></a>23.3.2.2 - <tt>multimap</tt> modifiers</h4>

<blockquote><pre><ins>
iterator insert(const value_type&amp; x);
template &lt;class P&gt; iterator insert(P&amp;&amp; x);
iterator insert(iterator position, const value_type&amp; x);
template &lt;class P&gt; iterator insert(iterator position, P&amp;&amp; x);
template &lt;class InputIterator&gt;
  void insert(InputIterator first, InputIterator last);
</ins></pre></blockquote>

<p><ins>
-1- <b>Requires:</b> Those signatures taking a <tt>const value_type&amp;</tt>
parameter requires both the <tt>key_type</tt> and the <tt>mapped_type</tt> to be
<tt>CopyConstructible</tt>.  The signatures taking a <tt>P&amp;&amp;</tt>
parameter require <tt>P</tt> to be convertible to <tt>value_type</tt>.  If
<tt>P</tt> is instantiated as a <tt>reference</tt> type, then the argument
<tt>x</tt> is copied from.  Otherwise <tt>x</tt> is considered to be an rvalue
as it is converted to <tt>value_type</tt> and inserted into the <tt>map</tt>.
Specifically, in such cases <tt>CopyConstructible</tt> is not required of
<tt>key_type</tt> or <tt>mapped_type</tt> unless the conversion from <tt>P</tt>
specifically requires it (e.g. if <tt>P</tt> is a <tt>tuple&lt;const key_type,
mapped_type&gt</tt>, then <tt>key_type</tt> must be <tt>CopyConstructible</tt>).
The signature taking <tt>InputIterator</tt> parameters does not require
<tt>CopyConstructible</tt> of either <tt>key_type</tt> or <tt>mapped_type</tt>
if the dereferenced <tt>InputIterator</tt> returns a non-const rvalue
<tt>pair&lt;key_type,mapped_type&gt;</tt>. Otherwise <tt>CopyConstructible</tt>
is required for both <tt>key_type</tt> and <tt>mapped_type</tt>.
</ins></p>

<h4><a name="23.3.2.3 - multimap operations"></a>23.3.2.<del>2</del><ins>3</ins> - <tt>multimap</tt> operations</h4>

<blockquote><pre>
iterator       find(const key_type &amp;x);
const_iterator find(const key_type&amp; x) const;

iterator       lower_bound(const key_type&amp; x);
const_iterator lower_bound(const key_type&amp; x) const;

pair&lt;iterator, iterator&gt;
  equal_range(const key_type&amp; x);
pair&lt;const_iterator, const_iterator&gt;
  equal_range(const_key_type&amp; x) const;
</pre></blockquote>

<p>
-1- The <tt>find</tt>, <tt>lower_bound</tt>, <tt>upper_bound</tt>, and
<tt>equal_range</tt> member functions each have two versions, one const and one
non-const. In each case the behavior of the two versions is identical except
that the const version returns a <tt>const_iterator</tt> and the non-const
version an <tt>iterator</tt>
(<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>).
</p>

<h4><a name="23.3.2.4 - multimap specialized algorithms"></a>23.3.2.<del>3</del><ins>4</ins> - <tt>multimap</tt> specialized algorithms</h4>

<blockquote><pre>
template &lt;class Key, class T, class Compare, class Allocator&gt;
  void swap(multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
            multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
<ins>template &lt;class Key, class T, class Compare, class Allocator&gt;
  void swap(multimap&lt;Key,T,Compare,Allocator&gt;&amp;&amp; x,
            multimap&lt;Key,T,Compare,Allocator&gt;&amp; y);
template &lt;class Key, class T, class Compare, class Allocator&gt;
  void swap(multimap&lt;Key,T,Compare,Allocator&gt;&amp; x,
            multimap&lt;Key,T,Compare,Allocator&gt;&amp;&amp; y);</ins>
</pre></blockquote>

<p>
-1- <b>Effects:</b>
</p>

<blockquote><pre>
  x.swap(y);
</pre></blockquote>

<h3><a name="23.3.3 - Class template set"></a>23.3.3 - Class template <tt>set</tt></h3>

<blockquote class="note">
<p>
See the <a href="#23.3.1 - Class template map"><tt>map</tt> description</a>
for rationale. </p>
</blockquote>

<p>
-2- A <tt>set</tt> satisfies all of the requirements of a container and of a
reversible container
(<a
href="lib-containers.html#lib.container.requirements">lib.container.requirements</a>),
and of an associative container
(<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>).
A <tt>set</tt> also provides most operations described in
(<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>)
for unique keys. This means that a <tt>set</tt> supports the <tt>a_uniq</tt>
operations in (<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>)
but not the <tt>a_eq</tt> operations. For a <tt>set&lt;Key&gt;</tt> both the
<tt>key_type</tt> and <tt>value_type</tt> are <tt>Key</tt>. Descriptions are
provided here only for operations on <tt>set</tt> that are not described in one
of these tables and for operations where there is additional semantic
information.
</p>

<blockquote><pre>
namespace std {
  template &lt;class Key, class Compare = less&lt;Key&gt;,
            class Allocator = allocator&lt;Key&gt; &gt;
  class set {
  public:
    //<i>  types:</i>
    typedef Key                                   key_type;
    typedef Key                                   value_type;
    typedef Compare                               key_compare;
    typedef Compare                               value_compare;
    typedef Allocator                             allocator_type;
    typedef typename Allocator::reference         reference;
    typedef typename Allocator::const_reference   const_reference;
    typedef <b>implementation defined</b>                iterator;       //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                const_iterator; //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                size_type;      //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                difference_type;//<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef typename Allocator::pointer           pointer;
    typedef typename Allocator::const_pointer     const_pointer;
    typedef std::reverse_iterator&lt;iterator&gt;       reverse_iterator;
    typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;

    //<i>  <a href="lib-containers.html#lib.set.cons">lib.set.cons</a> construct/copy/destroy:</i>
    explicit set(const Compare&amp; comp = Compare(),
                 const Allocator&amp; = Allocator());
    template &lt;class InputIterator&gt;
      set(InputIterator first, InputIterator last,
          const Compare&amp; comp = Compare(), const Allocator&amp; = Allocator());
    set(const set<del>&lt;Key,Compare,Allocator&gt;</del>&amp; x);
    <ins>set(set&amp;&amp; x);</ins>
   ~set();
    set<del>&lt;Key,Compare,Allocator&gt;</del>&amp; operator=
      (const set<del>&lt;Key,Compare,Allocator&gt;</del>&amp; x);
    <ins>set& operator=(set&amp;&amp; x);</ins>
    allocator_type get_allocator() const;

    //<i>  iterators:</i>
    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;

    //<i>  capacity:</i>
    bool          empty() const;
    size_type     size() const;
    size_type     max_size() const;

    //<i>  modifiers:</i>
    pair&lt;iterator,bool&gt; insert(const value_type&amp; x);
    <ins>pair&lt;iterator,bool&gt; insert(value_type&amp;&amp; x);</ins>
    iterator            insert(iterator position, const value_type&amp; x);
    <ins>iterator            insert(iterator position, value_type&amp;&amp; x);</ins>
    template &lt;class InputIterator&gt;
        void insert(InputIterator first, InputIterator last);

    void      erase(iterator position);
    size_type erase(const key_type&amp; x);
    void      erase(iterator first, iterator last);
    void swap(set<del>&lt;Key,Compare,Allocator&gt;</del>&amp;<ins>&amp;</ins>);
    void clear();

    //<i>  observers:</i>
    key_compare   key_comp() const;
    value_compare value_comp() const;

    //<i>  set operations:</i>
    iterator  find(const key_type&amp; x) const;
    size_type count(const key_type&amp; x) const;

    iterator  lower_bound(const key_type&amp; x) const;
    iterator  upper_bound(const key_type&amp; x) const;
    pair&lt;iterator,iterator&gt; equal_range(const key_type&amp; x) const;
  };

  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator==(const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&lt; (const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator!=(const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&gt; (const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&gt;=(const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&lt;=(const set&lt;Key,Compare,Allocator&gt;&amp; x,
                    const set&lt;Key,Compare,Allocator&gt;&amp; y);

  //<i>  specialized algorithms:</i>
  template &lt;class Key, class Compare, class Allocator&gt;
    void swap(set&lt;Key,Compare,Allocator&gt;&amp; x,
              set&lt;Key,Compare,Allocator&gt;&amp; y);
  <ins>template &lt;class Key, class Compare, class Allocator&gt;
    void swap(set&lt;Key,Compare,Allocator&gt;&amp;&amp; x,
              set&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    void swap(set&lt;Key,Compare,Allocator&gt;&amp; x,
              set&lt;Key,Compare,Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="23.3.3.1 - set constructors, copy, and assignment"></a>23.3.3.1 - <tt>set</tt> constructors, copy, and assignment</h4>

<blockquote><pre>
explicit set(const Compare&amp; comp = Compare(),
             const Allocator&amp; = Allocator());
</pre></blockquote>

<p>
-1- <b>Effects:</b> Constructs an empty set using the specified comparison
objects and allocator.
</p>

<p>
-2- <b>Complexity:</b> Constant.
</p>

<blockquote><pre>
template &lt;class InputIterator&gt;
  set(InputIterator <i>first</i>, InputIterator <i>last</i>,
      const Compare&amp; <i>comp</i> = Compare(), const Allocator&amp; = Allocator());
</pre></blockquote>

<p><ins>
-3- <b>Requires:</b> <tt>Key</tt> must be <tt>CopyConstructible</tt> only if the
dereferenced <tt>InputIterator</tt> returns an lvalue or const rvalue.
</ins></p>

<p>
-4- <b>Effects:</b> Constructs an empty <tt>set</tt> using the specified
comparison object and allocator, and inserts elements from the range
<tt>[<i>first</i>, <i>last</i>)</tt>.
</p>

<p>
-5- <b>Complexity:</b> Linear in <tt><i>N</i></tt> if the range
<tt>[<i>first</i>, <i>last</i>)</tt> is already sorted using
<tt><i>comp</i></tt> and otherwise <tt><i>N log N</i></tt>, where
<tt><i>N</i></tt> is <tt><i>last</i> - <i>first</i>></tt>.
</p>

<h4><a name="23.3.3.2 - set modifiers"></a>23.3.3.2 - <tt>set</tt> modifiers</h4>

<blockquote><pre><ins>
pair&lt;iterator,bool&gt; insert(const value_type&amp; x);
pair&lt;iterator,bool&gt; insert(value_type&amp;&amp; x);
iterator            insert(iterator position, const value_type&amp; x);
iterator            insert(iterator position, value_type&amp;&amp; x);
template &lt;class InputIterator&gt;
    void insert(InputIterator first, InputIterator last);
</ins></pre></blockquote>

<p><ins>
-1- <b>Requires:</b> Those signatures taking <tt>const value_type&amp;</tt>
parameters require <tt>Key</tt> to be <tt>CopyConstructible</tt>. The signature
taking <tt>InputIterator</tt> parameters requires <tt>Key</tt> to be
<tt>CopyConstructible</tt> only if the dereferenced <tt>InputIterator</tt>
returns an lvalue or const rvalue.
</ins></p>

<h4><a name="23.3.3.3 - set specialized algorithms"></a>23.3.3.<del>2</del><ins>3</ins> - <tt>set</tt> specialized algorithms</h4>

<blockquote><pre>
template &lt;class Key, class Compare, class Allocator&gt;
  void swap(set&lt;Key,Compare,Allocator&gt;&amp; x,
            set&lt;Key,Compare,Allocator&gt;&amp; y);
<ins>template &lt;class Key, class Compare, class Allocator&gt;
  void swap(set&lt;Key,Compare,Allocator&gt;&amp;&amp; x,
            set&lt;Key,Compare,Allocator&gt;&amp; y);
template &lt;class Key, class Compare, class Allocator&gt;
  void swap(set&lt;Key,Compare,Allocator&gt;&amp; x,
            set&lt;Key,Compare,Allocator&gt;&amp;&amp; y);</ins>
</pre></blockquote>

<p>
-1- <b>Effects:</b>
</p>

<blockquote><pre>
  x.swap(y);
</pre></blockquote>

<h3><a name="23.3.4 - Class template multiset"></a>23.3.4 - Class template <tt>multiset</tt></h3>

<blockquote class="note">
<p>
See the <a href="#23.3.1 - Class template map"><tt>map</tt> description</a>
for rationale. </p>
</blockquote>

<p>
-2- A <tt>multiset</tt> satisfies all of the requirements of a container and of
a reversible container
(<a
href="lib-containers.html#lib.container.requirements">lib.container.requirements</a>),
and of
an associative container (<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>).
<tt>multiset</tt> also provides most operations described in
(<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>)
for duplicate keys. This means that a <tt>multiset</tt> supports the
<tt>a_eq</tt>
operations in (<a
href="lib-containers.html#lib.associative.reqmts">lib.associative.reqmts</a>)
but not the <tt>a_uniq</tt> operations. For a <tt>multiset&lt;Key&gt;</tt> both
the <tt>key_type</tt> and <tt>value_type</tt> are <tt>Key</tt>. Descriptions are
provided here only for operations on <tt>multiset</tt> that are not described in
one of these tables and for operations where there is additional semantic
information.
</p>

<blockquote><pre>
namespace std {
  template &lt;class Key, class Compare = less&lt;Key&gt;,
            class Allocator = allocator&lt;Key&gt; &gt;
  class multiset {
  public:
    //<i>  types:</i>
    typedef Key                                   key_type;
    typedef Key                                   value_type;
    typedef Compare                               key_compare;
    typedef Compare                               value_compare;
    typedef Allocator                             allocator_type;
    typedef typename Allocator::reference         reference;
    typedef typename Allocator::const_reference   const_reference;
    typedef <b>implementation defined</b>                iterator;       //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                const_iterator; //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                size_type;      //<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef <b>implementation defined</b>                difference_type;//<i>  See <a href="lib-containers.html#lib.container.requirements">lib.container.requirements</a></i>
    typedef typename Allocator::pointer           pointer;
    typedef typename Allocator::const_pointer     const_pointer;
    typedef std::reverse_iterator&lt;iterator&gt;       reverse_iterator;
    typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;

    //<i>  construct/copy/destroy:</i>
    explicit multiset(const Compare&amp; comp = Compare(),
                      const Allocator&amp; = Allocator());
    template &lt;class InputIterator&gt;
      multiset(InputIterator first, InputIterator last,
               const Compare&amp; comp = Compare(),
               const Allocator&amp; = Allocator());
    multiset(const multiset<del>&lt;Key,Compare,Allocator&gt;</del>&amp; x);
    <ins>multiset(multiset&amp;&amp; x);</ins>
   ~multiset();
    multiset<del>&lt;Key,Compare,Allocator&gt;</del>&amp;
        operator=(const multiset<del>&lt;Key,Compare,Allocator&gt;</del>&amp; x);
    <ins>multiset&amp; operator=(multiset&amp;&amp; x);</ins>
    allocator_type get_allocator() const;

    //<i>  iterators:</i>
    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;

    //<i>  capacity:</i>
    bool          empty() const;
    size_type     size() const;
    size_type     max_size() const;

    //<i>  modifiers:</i>
    iterator insert(const value_type&amp; x);
    <ins>iterator insert(value_type&amp;&amp; x);</ins>
    iterator insert(iterator position, const value_type&amp; x);
    <ins>iterator insert(iterator position, value_type&amp;&amp; x);</ins>
    template &lt;class InputIterator&gt;
      void insert(InputIterator first, InputIterator last);

    void      erase(iterator position);
    size_type erase(const key_type&amp; x);
    void      erase(iterator first, iterator last);
    void swap(multiset<del>&lt;Key,Compare,Allocator&gt;</del>&amp;<ins>&amp;</ins>);
    void clear();

    //<i>  observers:</i>
    key_compare   key_comp() const;
    value_compare value_comp() const;

    //<i>  set operations:</i>
    iterator  find(const key_type&amp; x) const;
    size_type count(const key_type&amp; x) const;

    iterator  lower_bound(const key_type&amp; x) const;
    iterator  upper_bound(const key_type&amp; x) const;
    pair&lt;iterator,iterator&gt; equal_range(const key_type&amp; x) const;
  };

  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator==(const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&lt; (const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator!=(const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&gt; (const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&gt;=(const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    bool operator&lt;=(const multiset&lt;Key,Compare,Allocator&gt;&amp; x,
                    const multiset&lt;Key,Compare,Allocator&gt;&amp; y);

  //<i>  specialized algorithms:</i>
  template &lt;class Key, class Compare, class Allocator&gt;
    void swap(multiset&lt;Key,Compare,Allocator&gt;&amp; x,
              multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  <ins>template &lt;class Key, class Compare, class Allocator&gt;
    void swap(multiset&lt;Key,Compare,Allocator&gt;&amp;&amp; x,
              multiset&lt;Key,Compare,Allocator&gt;&amp; y);
  template &lt;class Key, class Compare, class Allocator&gt;
    void swap(multiset&lt;Key,Compare,Allocator&gt;&amp; x,
              multiset&lt;Key,Compare,Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="23.3.4.1 - multiset constructors, copy, and assignment"></a>23.3.4.1 - <tt>multiset</tt> constructors, copy, and assignment</h4>

<blockquote><pre>
explicit multiset(const Compare&amp; <tt><i>comp</i></tt> = Compare(),
                  const Allocator&amp; = Allocator());
</pre></blockquote>

<p>
-1- <b>Effects:</b> Constructs an empty set using the specified comparison
object and allocator.
</p>

<p>
-2- <b>Complexity:</b> Constant.
</p>

<blockquote><pre>
template &lt;class InputIterator&gt;
  multiset(InputIterator <tt><i>first</i></tt>, <tt><i>last</i></tt>,
           const Compare&amp; comp = Compare(), const Allocator&amp; = Allocator());
</pre></blockquote>

<p><ins>
-3- <b>Requires:</b> <tt>Key</tt> must be <tt>CopyConstructible</tt> only if the
dereferenced <tt>InputIterator</tt> returns an lvalue or const rvalue.
</ins></p>

<p>
-4- <b>Effects:</b> Constructs an empty <tt>multiset</tt> using the specified
comparison object and allocator, and inserts elements from the range
<tt>[<i>first</i>, <i>last</i>)</tt>.
</p>

<p>
-5- <b>Complexity:</b> Linear in <tt><i>N</i></tt> if the range
<tt>[<i>first</i>, <i>last</i>)</tt> is already sorted using
<tt><i>comp</i></tt> and otherwise <tt><i>N log N</i></tt>, where
<tt><i>N</i></tt> is <tt><i>last</i> - <i>first</i></tt>.
</p>

<h4><a name="23.3.4.2 - multiset modifiers"></a>23.3.4.2 - <tt>multiset</tt> modifiers</h4>

<blockquote><pre><ins>
iterator insert(const value_type&amp; x);
iterator insert(value_type&amp;&amp; x);
iterator insert(iterator position, const value_type&amp; x);
iterator insert(iterator position, value_type&amp;&amp; x);
template &lt;class InputIterator&gt;
  void insert(InputIterator first, InputIterator last);
</ins></pre></blockquote>

<p><ins>
-1- <b>Requires:</b> Those signatures taking <tt>const value_type&amp;</tt>
parameters require <tt>Key</tt> to be <tt>CopyConstructible</tt>. The signature
taking <tt>InputIterator</tt> parameters requires <tt>Key</tt> to be
<tt>CopyConstructible</tt> only if the dereferenced <tt>InputIterator</tt>
returns an lvalue or const rvalue.
</ins></p>

<h4><a name="23.3.4.3 - multiset specialized algorithms"></a>23.3.4.<del>2</del><ins>3</ins> - <tt>multiset</tt> specialized algorithms</h4>

<blockquote><pre>
template &lt;class Key, class Compare, class Allocator&gt;
  void swap(multiset&lt;Key,Compare,Allocator&gt;&amp; x,
            multiset&lt;Key,Compare,Allocator&gt;&amp; y);
<ins>template &lt;class Key, class Compare, class Allocator&gt;
  void swap(multiset&lt;Key,Compare,Allocator&gt;&amp;&amp; x,
            multiset&lt;Key,Compare,Allocator&gt;&amp; y);
template &lt;class Key, class Compare, class Allocator&gt;
  void swap(multiset&lt;Key,Compare,Allocator&gt;&amp; x,
            multiset&lt;Key,Compare,Allocator&gt;&amp;&amp; y);</ins>
</pre></blockquote>

<p>
-1- <b>Effects:</b>
</p>

<blockquote><pre>
  x.swap(y);
</pre></blockquote>

</body>
</html>
