﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>N3199 - More on noexcept for the General Utilities Library (version 2)</title>

  <style type="text/css">
    p {text-align:justify}
    li {text-align:justify}
    ins {background-color:#A0FFA0}
    del {background-color:#FF6666}
    
    tr.TITLE_ROW {text-align: center; font-weight: bold}
    tr.DELETED {background: #FF6666; text-decoration: line-through}
    tr.INSERTED {background: #FFFF99}
  </style>

  </head>

  <body>
<address>Document number: N3199=10-0189<br/>
  Date: 2010-11-11<br/>
  J. Daniel Garcia<br/>
  Project: Programming Language C++, Library Working Group<br />
  Reply To: <a href="mailto:josedaniel.garcia@uc3m.es">josedaniel.garcia@uc3m.es</a>
</address>
 
<hr/>

<h1>N3199 - More on noexcept for the General Utilities Library (version 2)</h1>

<p>During the Rapperswil meeting the Library Working Group decided to revise the library in terms of no except.
This paper presents proposed wording for some of these changes. The paper addresses National Body comments 
CH 16 and GB 60.</p>

<p>
This paper poposes additional changes to those presented in N3148 and N3149. Changes in this paper are
<b>restricted to chapter 20</b> (general utilities library).
</p>

<h1>Revision history</h1>

This paper is a revision of N3157. In this revision changes are targeted to:
<ul>
	<li>Cases where <tt>noexcept</tt> can be unconditionally expressed.</li>
	<li>Cases really needed for move support. This includes <tt>swap()</tt>, <tt>move()</tt> and <tt>forward()</tt>. 
	Besides, this case includes move constructors an move assignment</li>
</ul>

Other changes previously existing in N3157 are left out of this paper, so they can be discussed in isolation.

<h2>Discussion</h2>


<h3>Utility components</h3>

<p>
Function <tt>swap()</tt> is not able to throw if the corresponding move construction is not able to throw and the
corresponding move assignmente is not able to throw. This paper makes
it conditionally <tt>noexcept</tt>. The array specialization of <tt>swap()</tt> can be made <tt>noexcept</tt> in the
cases where individual <tt>swap()</tt> does not throw.
</p>

<p>
Functions <tt>forward()</tt> and <tt>move()</tt> essentially perform type transformations and therefore cannot throw. The
same can be applied tp <tt>move_if_noexcept()</tt>.
</p>

<p>For <tt>pair</tt> and <tt>tuple</tt> move constructors and move assignments have been made conditionally <tt>noexcept</tt>.
The same has been done to <tt>swap()</tt>.

<h3>Bitset</h3>

Some constructors of <tt>bitset</tt> cannot throw. This is the case of the following constructors:
<pre>
constexpr bitset();
constexpr bitset(unsigned long long val);
</pre>

<p>
Many bitset members do not need to throw. For example, setting a bit should not throw. However, those member functions
did not have a <tt>throw()</tt> specification. The proposal is to make all of them <tt>noexcept</tt>. This also affects to 
some free operators (<tt>&amp;</tt>, <tt>|</tt> and <tt>^</tt>).
</p>

<p>
However, some operators (<tt>&lt;&lt;</tt>, <tt>&gt;&gt;</tt>, <tt>&lt;&lt;=</tt> and <tt>&gt;&gt;=</tt>) remain
<tt>noexcept(false)</tt> as the specification does not have any requires elements, and the
intro says that generally bound violations may throw exceptions.
</p>

<h3>Function objects</h3>

<p>For the polymorphic function wrapper the following changes have been made:</p>
<ul>
  <li>Move constructor has been made <tt>noexcept</tt>.</li>
  <li>Move assignment <u>has not</u> been made noexcept in this case</tt> as it have throwing implications
derived from perfect forwarding.</li>
  <li>Specialized algorithm <tt>swap()</tt> can be safely made <tt>noexcept</tt> as it only depends on the 
  non-throwing <tt>swap()</tt> member function.</li>
</ul>

<h3>Memory</h3>

<p>
Getting the address of a reference through an allocator (<tt>allocator&lt;T&gt;::address()</tt>) does not
throw. Note that it does not make use of <tt>operator&amp;</tt> which avoids the activation of a user-defined
unary <tt>operator&amp;</tt> which could throw. Thus, <tt>address()</tt> operation has been made <tt>noexcept</tt>.
</p>

<p>
Operations in class <tt>raw_storage_iterator</tt> should not throw (except assignment). All its members have 
been made <tt>noexcept</tt>. 
</p>

<p>
Temporary buffers management functions do not throw. Instead <tt>get_temporary_buffer()</tt> returns a
pair of 0 values if not successful. They have been maded <tt>noexcept</tt>.
</p>

<p>
Function <tt>swap()</tt> for <tt>unique_ptr</tt>'s has been made <tt>noexcept</tt>.
</p>

<p>
<tt>operator*</tt> for <tt>unique_ptr</tt> and <tt>operator[]</tt> for array specialization of <tt>unique_ptr</tt> both
are based on <tt>get()</tt> which does not throw. So both operators have been made <tt>noexcept</tt>. The same is applied
to sepcializations of <tt>swap()</tt> algorithm (based on non-throwing <tt>swap()</tt> member function).
</p>

<p>
In <tt>shared_ptr</tt>, assignment operators are based on non-throwing <tt>swap()</tt>. However, only those versions
based on non-throwing constructors may be made <tt>noexcept</tt>. The same can be applied to the first version of
<tt>reset()</tt>.
</p>

<p>
For <tt>weak_ptr</tt> member function <tt>reset()</tt> does not throw as it is based on non-throwing <tt>swap()</tt>.
</p>

<p>
Some functions for atomic access to <tt>shared_ptr</tt>s (the non-explicit) ones have been made <tt>noexcept</tt>
as they rest on the <em>explicit</em> versions, which are already non-throwing.
</p>

<p>Function <tt>align</tt> does not throw because on failure it <em>does nothing</em>.</p>

<h3>Scoped allocator</h3>

<p>Scoped allocator operators <tt>==</tt> has been made <tt>noexcept</tt> to satisfy <em>Allocator</em> requirements. The same
applies to operator <tt>!=</tt> which defined in terms of operator <tt>==</tt>.</p>

<p>
Because an scoped allocator must meet allocator requirements, its constructors (except de default constructor) cannot throw. Every
such constructor has been made <tt>noexcept</tt>.
</p>

<p>
Member functions for accessing inner and outer allocators all return references to the required allocator.
They have been made <tt>noexcept</tt>.
</p>

<p>
Member function <tt>deallocate()</tt> must be non-throwing because of allocator requirements. It has
been made <tt>noexcept</tt>.
</p>

<h2>Acknowledgments</h2>

I am very grateful to Daniel Kr&uuml;gler and Pablo Halpern for their review and suggestions.

<h1>Proposed Wording</h1>

<h2>20.3 Utility components</h2>

After p. 1
<pre>
#include &lt;initializer_list&gt;
namespace std {
...
  // 20.3.2, swap:
  template&lt;class T&gt; void swap(T&amp; a, T&amp; b)<ins> noexcept(<em>see below</em>)</ins>;
  template&lt;class T, size_t N&gt; void swap(T (&amp;a)[N], T (&amp;b)[N]) <ins>noexcept(noexcept(swap(*a,*b)))</ins>;
...
  // 20.3.3, forward/move:
  template &lt;class T, class U&gt; T&amp;&amp; forward(U&amp;&amp;)<ins> noexcept</ins>;
  template &lt;class T&gt; typename remove_reference&lt;T&gt;::type&amp;&amp; move(T&amp;&amp;)<ins> noexcept</ins>;
  template &lt;class T&gt; typename conditional&lt;
    !has_nothrow_move_constructor&lt;T&gt;::value &amp;&amp; has_copy_constructor&lt;T&gt;::value,
    const T&amp;, T&amp;&amp;&gt;::type move_if_noexcept(T&amp; x)<ins> noexcept</ins>;
...
  // 20.3.5.4, tuple-like access to pair:
...
  template&lt;size_t I, class T1, class T2&gt;
    typename tuple_element&lt;I, std::pair&lt;T1, T2&gt; &gt;::type&amp; get(std::pair&lt;T1, T2&gt;&amp;)<ins>noexcept</ins>;
  template&lt;size_t I, class T1, class T2&gt; const
    typename const tuple_element&lt;I, std::pair&lt;T1, T2&gt; &gt;::type&amp; get(const std::pair&lt;T1, T2&gt;&amp;)<ins>noexcept</ins>;
...
}
</pre>


<h2>20.3.2 swap</h2>

Before p. 1
<pre>template&lt;class T&gt; void swap(T&amp; a, T&amp; b)<ins> noexcept(<em>see below</em>);</pre>
<p><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
  <ins>is_nothrow_move_constructible&lt;T&gt;::value &amp;&amp;</ins>
  <ins>is_nothrow_move_assignable&lt;T&gt;::value</ins>
</pre>

Before p. 3
<pre>
template&lt;class T, size_t N&gt;
  void swap(T (&amp;a)[N], T (&amp;b)[N])<ins> noexcept(noexcept(swap(*a,*b)))</ins>;
</pre>

<h2>20.3.3 forward/move helpers</h2>

After p. 1
<pre>template &lt;class T, class U&gt; T&amp;&amp; forward(U&amp;&amp; u)<ins> noexcept</ins>;</pre>

After p. 5
<pre>template &lt;class T&gt; typename remove_reference&lt;T&gt;::type&amp;&amp; move(T&amp;&amp; t)<ins> noexcept</ins>;</pre>

After p. 8
<pre>
template &lt;class T&gt; typename conditional&lt;
  !has_nothrow_move_constructor&lt;T&gt;::value &amp;&amp; has_copy_constructor&lt;T&gt;::value,
  const T&amp;, T&amp;&amp;&gt;::type move_if_noexcept(T&amp; x)<ins> noexcept</ins>;
</pre>

<h2>20.3.5.2 Class template pair</h2>

Before p. 1
<pre>
namespace std {
  template &lt;class T1, class T2&gt;
  struct pair {
    typedef T1 first_type;
    typedef T2 second_type;

    T1 first;
    T2 second;
    pair(const pair&amp;) = default;
    constexpr pair();
    pair(const T1&amp; x, const T2&amp; y);
    template&lt;class U, class V&gt; pair(U&amp;&amp; x, V&amp;&amp; y)<ins> noexcept(<em>see below</em>)</ins>;
    template&lt;class U, class V&gt; pair(const pair&lt;U, V&gt;&amp; p);
    template&lt;class U, class V&gt; pair(pair&lt;U, V&gt;&amp;&amp; p)<ins> noexcept(<em>see below</em>)</ins>;
    template &lt;class... Args1, class... Args2&gt;
      pair(piecewise_construct_t,
	   tuple&lt;Args1...&gt; first_args, tuple&lt;Args2...&gt; second_args)<ins> noexcept(<em>see below</em>)</ins>;

    template&lt;class U, class V&gt; pair&amp; operator=(const pair&lt;U, V&gt;&amp; p);
      pair&amp; operator=(pair&amp;&amp; p);
    template&lt;class U, class V&gt; pair&amp; operator=(pair&lt;U, V&gt;&amp;&amp; p)<ins> noexcept(<em>see below</em>)</ins>;

    void swap(pair&amp; p)<ins>noexcept(<em>see below</em>)</ins>;
  };
}
</pre>

Before p. 3
<pre>template&lt;class U, class V&gt; pair(U&amp;&amp; x, V&amp;&amp; y)<ins> noexcept(<em>see below</em>)</ins>;</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
  <ins>is_nothrow_constructible&lt;T1, U&amp;&amp;&gt;::value &amp;&amp;</ins>
  <ins>is_nothrow_constructible&lt;T2, V&amp;&amp;&gt;::value</ins>
</pre>

Before p. 6
<pre>template&lt;class U, class V&gt; pair(pair&lt;U, V&gt;&amp;&amp; p)<ins> noexcept(<em>see below</em>)</ins>;</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
  <ins>is_nothrow_constructible&lt;T1, U&amp;&amp;&gt;::value &amp;&amp;</ins>
  <ins>is_nothrow_constructible&lt;T2, V&amp;&amp;&gt;::value</ins>
</pre>

Before p. 7
<pre>
template&lt;class... Args1, class... Args2&gt;
  pair(piecewise_construct_t,
       tuple&lt;Args1...&gt; first_args, tuple&lt;Args2...&gt; second_args)<ins>noexcept(<em>see below</em>)</ins>;
</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
  <ins>is_nothrow_constructible&lt;T1, Args1&amp;&amp;...&gt;::value &amp;&amp;</ins>
  <ins>is_nothrow_constructible&lt;T2, Args2&amp;&amp;...&gt;::value</ins>
</pre>

Before p. 12
<pre>pair&amp; operator=(pair&amp;&amp; p)<ins> noexcept(<em>see below</em>)</ins>;</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
  <ins>is_nothrow_move_assignable&lt;T1&gt;::value &amp;&amp;</ins>
  <ins>is_nothrow_move_assignable&lt;T2&gt;::value</ins>
</pre>

Before p. 14
<pre>template&lt;class U, class V&gt; pair&amp; operator=(pair&lt;U, V&gt;&amp;&amp; p)<ins> noexcept(<em>see below</em>)</ins>;</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
  <ins>is_nothrow_assignable&lt;T1&amp;, U&amp;&amp;&gt;::value &amp;&amp;</ins>
  <ins>is_nothrow_assignable&lt;T2&amp;, V&amp;&amp;&gt;::value</ins>
</pre>

Before p. 16
<pre>void swap(pair&amp; p)<ins>noexcept(<em>see below</em>)</ins>;</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
  <ins>noexcept(swap(first, p.first)) &amp;&amp;</ins>
  <ins>noexcept(swap(second, p.second))</ins>
</pre>

<h2>20.3.5.3 Specialized algorithms</h2>

After p. 6
<pre>
template&lt;class T1, class T2&gt; void swap(pair&lt;T1, T2&gt;&amp; x, pair&lt;T1, T2&gt;&amp; y)<ins>
  noexcept(noexcept(x.swap(y)))</ins>;
</pre>

After p. 7
<pre>
template &lt;class T1, class T2&gt;
  pair&lt;V1, V2&gt; make_pair(T1&amp;&amp;, T2&amp;&amp;)<ins> noexcept(<em>see below</em>);
</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
  <ins>is_nothrow_constructible&lt;V1, T1&amp;&amp;&gt;::value &amp;&amp;</ins>
  <ins>is_nothrow_constructible&lt;V2, T2&amp;&amp;&gt;::value</ins>
</pre>

<h2>20.3.5.4 Tuple-like access to pair</h2>

After p. 4
<pre>
template&lt;size_t I, class T1, class T2&gt;
  typename tuple_element&lt;I, std::pair&lt;T1, T2&gt; &gt;::type&amp; get(pair&lt;T1, T2&gt;&amp;)<ins> noexcept</ins>;
template&lt;size_t I, class T1, class T2&gt;
  const typename tuple_element&lt;I, std::pair&lt;T1, T2&gt; &gt;::type&amp; get(const pair&lt;T1, T2&gt;&amp;)<ins> noexcept</ins>;
</pre>

<h2>20.4.1 In general</h2>

After p. 2
<pre>
namespace std {
...
  // 20.4.2.4, tuple creation functions:
...
  template &lt;class... Types&gt;
    tuple&lt;ATypes...&gt; pack_arguments forward_as_tuple(Types&amp;&amp;...)<ins> noexcept</ins>;
  template&lt;class... Types&gt;
    tuple&lt;Types&amp;...&gt; tie(Types&amp;...)<ins> noexcept</ins>;
...
}
</pre>

<h2>20.4.2 Class template tuple</h2>

Before p. 1
<pre>
namespace std {
  template &lt;class... Types&gt;
  class tuple {
  public:

    // 20.4.2.1, tuple construction
...
    template &lt;class... UTypes&gt;
      explicit tuple(UTypes&amp;&amp;...)<ins> noexcept(<em>see below</em>)</ins>;
...  
    template &lt;class... UTypes&gt;
      tuple(tuple&lt;UTypes...&gt;&amp;&amp;)<ins> noexcept(<em>see below</em>)</ins>;

...
    template &lt;class U1, class U2&gt;
      tuple(pair&lt;U1, U2&gt;&amp;&amp;)<ins> noexcept(<em>see below</em>)</ins>; // iff sizeof...(Types) == 2
...
    // 20.4.2.2, tuple assignment
...
    tuple&amp; operator=(tuple&amp;&amp;)<ins> noexcept(<em>see below</em>)</ins>;
...  
    template &lt;class... UTypes&gt;
      tuple&amp; operator=(tuple&lt;UTypes...&gt;&amp;&amp;)<ins> noexcept(<em>see below</em>)</ins>;
...  
    template &lt;class U1, class U2&gt;
      tuple&amp; operator=(pair&lt;U1, U2&gt;&amp;&amp;)<ins> noexcept(<em>see below</em>)</ins>; // iff sizeof...(Types) == 2
  
    // 20.4.2.3, tuple swap
    void swap(tuple&amp;)<ins> noexcept(<em>see below</em>)</ins>;

  };
}
</pre>

<h2>20.4.2.1 Construction</h2>

Before p. 6
<pre>
template &lt;class... UTypes&gt;
  explicit tuple(UTypes&amp;&amp;... u)<ins> noexcept(<em>see below</em>)</ins>;
</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to the logical and of the following expressions:</ins></p>
<pre>
  <ins>is_nothrow_constructible&lt;T<sub>i</sub>, U<sub>i</sub>&amp;&amp;&gt;::value</ins>
</pre>
<p><ins>where <tt>T<sub>i</sub></tt> is the i-th type in <tt>Types</tt> and <tt>U<sub>i</sub></tt> is the i-th type in <tt>UTypes</tt></ins>.</p>

Before p. 15
<pre>template &lt;class... UTypes&gt; tuple(tuple&lt;UTypes...&gt;&amp;&amp; u)<ins> noexcept(<em>see below</em>)</ins>;</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to the logical and of the following expressions:</ins></p>
<pre>
  <ins>is_nothrow_constructible&lt;T<sub>i</sub>, U<sub>i</sub>&amp;&amp;&gt;::value</ins>
</pre>
<p><ins>where <tt>T<sub>i</sub></tt> is the i-th type in <tt>Types</tt> and <tt>U<sub>i</sub></tt> is the i-th type in <tt>UTypes</tt></ins>.</p>

Before p. 19
<pre>template &lt;class U1, class U2&gt; tuple(pair&lt;U1, U2&gt;&amp;&amp; u)<ins> noexcept(<em>see below</em>)</ins>;</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
  <ins>is_nothrow_constructible&lt;T<sub>1</sub>, U1&amp;&amp;&gt;::value &amp;&amp;</ins>
  <ins>is_nothrow_constructible&lt;T<sub>2</sub>, U2&amp;&amp;&gt;::value</ins>
</pre>
<p><ins>where <tt>T<sub>i</sub></tt> is the i-th type in <tt>Types</tt>.</ins></p>

<h2>20.4.2.2 Assignment</h2>

Before p. 5
<pre>tuple&amp; operator=(tuple&amp;&amp; u)<ins> noexcept(<em>see below</em>)</ins>;</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to the logical and of the following expressions:</ins></p>
<pre>
  <ins>is_nothrow_move_assignable&lt;T<sub>i</sub>&gt;::value</ins>
</pre>
<p><ins>where <tt>T<sub>i</sub></tt> is the i-th type in <tt>Types</tt>.</ins></p>

Before p. 11
<pre>
template &lt;class... UTypes&gt;
  tuple&amp; operator=(tuple&lt;UTypes...&gt;&amp;&amp; u)<ins> noexcept(<em>see below</em>)</ins>;
</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to the logical and of the following expressions:</ins></p>
<pre>
  <ins>is_nothrow_assignable&lt;T<sub>i</sub>&amp;, U<sub>i</sub>&amp;&amp;&gt;::value</ins>
</pre>
<p><ins>where <tt>T<sub>i</sub></tt> is the i-th type in <tt>Types</tt> and <tt>U<sub>i</sub></tt> is the i-th type in <tt>UTypes</tt></ins>.</p>

Before p. 18
<pre>template &lt;class U1, class U2&gt; tuple&amp; operator=(pair&lt;U1, U2&gt;&amp;&amp; u)<ins> noexcept(<em>see below</em>)</ins>;</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
  <ins>is_nothrow_assignable&lt;T<sub>1</sub>&amp;, U1&amp;&amp;&gt;::value &amp;&amp;</ins>
  <ins>is_nothrow_assignable&lt;T<sub>2</sub>&amp;, U2&amp;&amp;&gt;::value</ins>
</pre>
<p><ins>where <tt>T<sub>i</sub></tt> is the i-th type in <tt>Types</tt>.</ins></p>

<h2>20.4.2.3 swap</h2>

Before p. 1
<pre>void swap(tuple&amp; rhs)<ins> noexcept(<em>see below</em>)</ins>;</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to the logical and of the following expressions:</ins></p>
<pre>
  <ins>noexcept(swap(declval&lt;T<sub>i</sub>&amp;&gt;(), declval&lt;T<sub>i</sub>&amp;&gt;()))</ins>
</pre>
<p><ins>where <tt>T<sub>i</sub></tt> is the i-th type in <tt>Types</tt>.</ins></p>

<h2>20.4.2.4 Tuple creation functions</h2>

Before p. 4
<pre>
template&lt;class... Types&gt;
  tuple&lt;Types&amp;&amp;...&gt;forward_as_tuple(Types&amp;&amp;... t)<ins> noexcept</ins>;
</pre>

Before p. 6
<pre>
template&lt;class... Types&gt;
  tuple&lt;Types&amp;...&gt; tie(Types&amp;... t)<ins> noexcept</ins>;
</pre>

<h2>20.4.2.9 Tuple specialized algorithms</h2>

Before p. 1
<pre>
template &lt;class... Types&gt;
  void swap(tuple&lt;Types...&gt;&amp; x, tuple&lt;Types...&gt;&amp; y)<ins> noexcept(<em>see below</em>)</ins>;
</pre>
<p><ins><em>Remarks</em>: The expression inside <tt>noexcept</tt> is equivalent to:</ins></p>
<pre>
    <ins>noexcept(x.swap(y))</ins>;
</pre>

<h2>20.5 Class template bitset</h2>

Before p. 1
<pre>
#include &lt;string&gt;
#include &lt;iosfwd&gt; // for istream, ostream
namespace std {
  template &lt;size_t N&gt; class bitset;

  // 20.5.4 bitset operators:
  template &lt;size_t N&gt;
    bitset&lt;N&gt; operator&amp;(const bitset&lt;N&gt;&amp;, const bitset&lt;N&gt;&amp;)<ins> noexcept</ins>;
  template &lt;size_t N&gt;
    bitset&lt;N&gt; operator|(const bitset&lt;N&gt;&amp;, const bitset&lt;N&gt;&amp;)<ins> noexcept</ins>;
  template &lt;size_t N&gt;
    bitset&lt;N&gt; operator^(const bitset&lt;N&gt;&amp;, const bitset&lt;N&gt;&amp;)<ins> noexcept</ins>;
  template &lt;class charT, class traits, size_t N&gt;
    basic_istream&lt;charT, traits&gt;&amp;
    operator&gt;&gt;(basic_istream&lt;charT, traits&gt;&amp; is, bitset&lt;N&gt;&amp; x);
  template &lt;class charT, class traits, size_t N&gt;
    basic_ostream&lt;charT, traits&gt;&amp;
    operator&lt;&lt;(basic_ostream&lt;charT, traits&gt;&amp; os, const bitset&lt;N&gt;&amp; x);
}
</pre>

After p. 1
<pre>
namespace std {
  template&lt;size_t N&gt; class bitset {
  public:
    // bit reference:
    class reference {
      friend class bitset;
      reference()<ins> noexcept</ins>;
    public:
      ~reference()<ins> noexcept</ins>;
      reference&amp; operator=(bool x)<ins> noexcept</ins>; // for b[i] = x;
      reference&amp; operator=(const reference&amp;)<ins> noexcept</ins>; // for b[i] = b[j];
      bool operator~() const<ins> noexcept</ins>; // flips the bit
      operator bool() const<ins> noexcept</ins>; // for x = b[i];
      reference&amp; flip()<ins> noexcept</ins>; // for b[i].flip();
    };

    // 20.5.1 constructors:
    constexpr bitset()<ins> noexcept</ins>;
    constexpr bitset(unsigned long long val)<ins> noexcept</ins>;
    template&lt;class charT, class traits, class Allocator&gt;
      explicit bitset(
        const basic_string&lt;charT,traits,Allocator&gt;&amp; str,
        typename basic_string&lt;charT,traits,Allocator&gt;::size_type pos = 0,
        typename basic_string&lt;charT,traits,Allocator&gt;::size_type n =
          basic_string&lt;charT,traits,Allocator&gt;::npos,
          charT zero = charT(0), charT one = charT(1));
    explicit bitset(const char *str);

    // 20.5.2 bitset operations:
    bitset&lt;N&gt;&amp; operator&amp;=(const bitset&lt;N&gt;&amp; rhs)<ins> noexcept</ins>;
    bitset&lt;N&gt;&amp; operator|=(const bitset&lt;N&gt;&amp; rhs)<ins> noexcept</ins>;
    bitset&lt;N&gt;&amp; operator^=(const bitset&lt;N&gt;&amp; rhs)<ins> noexcept</ins>;
...
    bitset&lt;N&gt;&amp; set()<ins> noexcept</ins>;
    bitset&lt;N&gt;&amp; set(size_t pos, bool val = true);
    bitset&lt;N&gt;&amp; reset()<ins> noexcept</ins>;
    bitset&lt;N&gt;&amp; reset(size_t pos);
    bitset&lt;N&gt; operator~() const<ins> noexcept</ins>;
    bitset&lt;N&gt;&amp; flip()<ins> noexcept</ins>;
    bitset&lt;N&gt;&amp; flip(size_t pos);

    // element access:
    constexpr bool operator[](size_t pos) const; // for b[i];
    reference operator[](size_t pos); // for b[i];

    unsigned long to_ulong() const;
    unsigned long long to_ullong() const;
    template &lt;class charT = char,
        class traits = char_traits&lt;charT&gt;,
        class Allocator = allocator&lt;charT&gt; &gt;
      basic_string&lt;charT, traits, Allocator&gt;
      to_string(charT zero = charT(0), charT one = charT(1)) const;
    size_t count() const<ins> noexcept</ins>;
    constexpr size_t size()<ins> noexcept</ins>;
    bool operator==(const bitset&lt;N&gt;&amp; rhs) const<ins> noexcept</ins>;
    bool operator!=(const bitset&lt;N&gt;&amp; rhs) const<ins> noexcept</ins>;
    bool test(size_t pos);
    bool all() const<ins> noexcept</ins>;
    bool any() const<ins> noexcept</ins>;
    bool none() const<ins> noexcept</ins>;
...
  };

  // 20.5.3 Hash support
  template &lt;class T&gt; struct hash;
  template &lt;size_t N&gt; struct hash&lt;bitset&lt;N&gt; &gt;;
}
</pre>

<h2>20.5.1 bitset constructors</h2>

Before p. 1
<pre>constexpr bitset()<ins> noexcept</ins>;</pre>

After p. 1
<pre>constexpr bitset(unsigned long long val)<ins> noexcept</ins>;</pre>

<h2>20.5.2 bitset members</h2>

Before p. 1
<pre>bitset&lt;N&gt;&amp; operator&amp;=(const bitset&lt;N&gt;&amp; rhs)<ins> noexcept</ins>;</pre>

After p. 2
<pre>bitset&lt;N&gt;&amp; operator|=(const bitset&lt;N&gt;&amp; rhs)<ins> noexcept</ins>;</pre>

After p. 4
<pre>bitset&lt;N&gt;&amp; operator^=(const bitset&lt;N&gt;&amp; rhs)<ins> noexcept</ins>;</pre>

After p. 6
<pre>bitset&lt;N&gt;&amp; operator&lt;&lt;=(size_t pos)<ins> noexcept</ins>;</pre>

After p. 8
<pre>bitset&lt;N&gt;&amp; operator&gt;&gt;=(size_t pos)<ins> noexcept</ins>;</pre>

After p. 10
<pre>bitset&lt;N&gt;&amp; set()<ins> noexcept</ins>;</pre>

After p. 16
<pre>bitset&lt;N&gt;&amp; reset()<ins> noexcept</ins>;</pre>

After p. 22
<pre>bitset&lt;N&gt; operator~() const<ins> noexcept</ins>;</pre>

After p. 24
<pre>bitset&lt;N&gt;&amp; flip()<ins> noexcept</ins>;</pre>

After p. 36
<pre>size_t count() const<ins> noexcept</ins>;</pre>

After p. 37
<pre>constexpr size_t size()<ins> noexcept</ins>;</pre>

After p. 38
<pre>bool operator==(const bitset&lt;N&gt;&amp; rhs) const<ins> noexcept</ins>;</pre>

After p. 39
<pre>bool operator!=(const bitset&lt;N&gt;&amp; rhs) const<ins> noexcept</ins>;</pre>

After p. 43
<pre>bool all() const<ins> noexcept</ins>;</pre>

After p. 44
<pre>bool any() const<ins> noexcept</ins>;</pre>

After p. 45
<pre>bool none() const<ins> noexcept</ins>;</pre>

After p. 46
<pre>bitset&lt;N&gt; operator&lt;&lt;(size_t pos) const<ins> noexcept</ins>;</pre>

After p. 47
<pre>bitset&lt;N&gt; operator&gt;&gt;(size_t pos) const<ins> noexcept</ins>;</pre>

<h2>20.5.4 bitset operators</h2>

Before p. 1
<pre>bitset&lt;N&gt; operator&amp;(const bitset&lt;N&gt;&amp; lhs, const bitset&lt;N&gt;&amp; rhs)<ins> noexcept</ins>;</pre>

After p. 1
<pre>bitset&lt;N&gt; operator|(const bitset&lt;N&gt;&amp; lhs, const bitset&lt;N&gt;&amp; rhs)<ins> noexcept</ins>;</pre>

After p. 2
<pre>bitset&lt;N&gt; operator^(const bitset&lt;N&gt;&amp; lhs, const bitset&lt;N&gt;&amp; rhs)<ins> noexcept</ins>;</pre>


<h2>20.8.14.1 Class bad_function_call</h2>

After p. 1
<pre>
namespace std {
  class bad_function_call : public std::exception {
  public:
    // 20.8.14.1.1, constructor:
    bad_function_call()<ins> noexcept</ins>;
  };
} // namespace std
</pre>

<h2>20.8.14.1.1 bad_function_call constructor</h2>

Before p. 1
<pre>bad_function_call()<ins> noexcept</ins>;</pre>

<h2>20.9 Memory</h2>

After p. 1
<pre>
namespace std {
...
  // 20.9.8, temporary buffers:
  template &lt;class T&gt;
    pair&lt;T*,ptrdiff_t&gt; get_temporary_buffer(ptrdiff_t n)<ins> noexcept</ins>;
  template &lt;class T&gt;
    void return_temporary_buffer(T* p)<ins> noexcept</ins>;
...
    // 20.9.11.5, shared_ptr atomic access:
...
    template&lt;class T&gt;
      shared_ptr&lt;T&gt; atomic_load(const shared_ptr&lt;T&gt;* p)<ins> noexcept</ins>;
...
    template&lt;class T&gt;
      void atomic_store(shared_ptr&lt;T&gt;* p, shared_ptr&lt;T&gt; r)<ins> noexcept</ins>;
...
    template&lt;class T&gt;
      shared_ptr&lt;T&gt; atomic_exchange(shared_ptr&lt;T&gt;* p, shared_ptr&lt;T&gt; r)<ins> noexcept</ins>;
...
    template&lt;class T&gt;
      bool atomic_compare_exchange_weak(
        shared_ptr&lt;T&gt;* p, shared_ptr&lt;T&gt;* v, shared_ptr&lt;T&gt; w)<ins> noexcept</ins>;
    template&lt;class T&gt;
      bool atomic_compare_exchange_strong(
        shared_ptr&lt;T&gt;* p, shared_ptr&lt;T&gt;* v, shared_ptr&lt;T&gt; w)<ins> noexcept</ins>;
...
}
</pre>

<h2>20.9.4 Allocator traits</h2>

After p. 1
<pre>
namespace std {
  template &lt;class Alloc&gt; struct allocator_traits {
...
  static void deallocate(Alloc&amp; a, pointer p, size_type n)<ins> noexcept</ins>;
...
  };
}
</pre>

<h2>20.9.4.2 Allocator traits static member functions</h2>

After p. 2
<pre>static void deallocate(Alloc&amp; a, pointer p, size_type n)<ins> noexcept</ins>;</pre>

<h2>20.9.5 The default allocator</h2>

Before p. 1
<pre>
namespace std {
  template &lt;class T&gt; class allocator;
...
  template &lt;class T&gt; class allocator {
  public:
...
    pointer address(reference x) const<ins> noexcept</ins>;
    const_pointer address(const_reference x) const<ins> noexcept</ins>;
...
    void deallocate(pointer p, size_type n)<ins> noexcept</ins>;
...
  };
}
</pre>

<h2>20.9.5.1 allocator members</h2>

After p. 1
<pre>pointer address(reference x) const<ins> noexcept</ins>;</pre>

After p. 2
<pre>const_pointer address(const_reference x) const<ins> noexcept</ins>;</pre>

After p. 7
<pre>
void deallocate(pointer p, size_type n)<ins> noexcept</ins>;
</pre>

<h2>20.9.7 Raw storage iterator</h2>

After p. 1
<pre>
namespace std {
  template &lt;class OutputIterator, class T&gt;
  class raw_storage_iterator
    : public iterator&lt;output_iterator_tag,void,void,void,void&gt; {
  public:
    explicit raw_storage_iterator(OutputIterator x)<ins> noexcept</ins>;

    raw_storage_iterator&lt;OutputIterator,T&gt;&amp; operator*()<ins> noexcept</ins>;
...
    raw_storage_iterator&lt;OutputIterator,T&gt;&amp; operator++()<ins> noexcept</ins>;
    raw_storage_iterator&lt;OutputIterator,T&gt; operator++(int)<ins> noexcept</ins>;
  };
}
</pre>

Before p. 2
<pre>raw_storage_iterator(OutputIterator x)<ins> noexcept</ins>;</pre>

After p. 2
<pre>raw_storage_iterator&lt;OutputIterator,T&gt;&amp; operator*()<ins> noexcept</ins>;</pre>

After p. 5
<pre>raw_storage_iterator&lt;OutputIterator,T&gt;&amp; operator++()<ins> noexcept</ins>;</pre>

After p. 6
<pre>raw_storage_iterator&lt;OutputIterator,T&gt; operator++(int)<ins> noexcept</ins>;</pre>

<h2>20.9.8 Temporary buffers</h2>

Before p. 1
<pre>
template &lt;class T&gt;
  pair&lt;T*, ptrdiff_t&gt; get_temporary_buffer(ptrdiff_t n)<ins> noexcept</ins>;
</pre>

After p. 2
<pre>
template &lt;class T&gt; void return_temporary_buffer(T* p)<ins> noexcept</ins>;
</pre>


<h2>20.9.10 Class template unique_ptr</h2>

After p. 6
<pre>
namespace std {
  template&lt;class T&gt; struct default_delete;
  template&lt;class T&gt; struct default_delete&lt;T[]&gt;;

  template&lt;class T, class D = default_delete&lt;T&gt;&gt; class unique_ptr;
  template&lt;class T, class D&gt; class unique_ptr&lt;T[], D&gt;;

  template&lt;class T, class D&gt; void swap(unique_ptr&lt;T, D&gt;&amp; x, unique_ptr&lt;T, D&gt;&amp; y)<ins> noexcept</ins>;

...
}
</pre>

<h2>20.9.10.1.2 default_delete</h2>

Before p. 1
<pre>
namespace std {
  template &lt;class T&gt; struct default_delete {
    constexpr default_delete()<ins> noexcept</ins>;
    template &lt;class U&gt; default_delete(const default_delete&lt;U&gt;&amp;)<ins> noexcept</ins>;
    void operator()(T*) const;
  };
}

constexpr default_delete()<ins> noexcept</ins>;
</pre>

After p. 1
<pre>template &lt;class U&gt; default_delete(const default_delete&lt;U&gt;& other)<ins> noexcept</ins>;</pre>

<h2>20.9.10.1.3 default_delete&lt;T[]&gt;</h2>

Before p. 1
<pre>
namespace std {
  template &lt;class T&gt; struct default_delete&lt;T[]&gt; {
    constexpr default_delete()<ins> noexcept</ins>;
    void operator()(T* ptr) const;
    template <class U> void operator()(U*) const = delete;
  };
}
</pre>

<h2>20.9.10.4 unique_ptr specialized algorithms</h2>

Before p. 1
<pre>template &lt;class T, class D&gt; void swap(unique_ptr&lt;T, D&gt;&amp; x, unique_ptr&lt;T, D&gt;&amp; y)<ins> noexcept</ins>;</pre>


<h2>20.9.11.2 Class template shared_ptr</h2>

After p. 1
<pre>
namespace std {
  template&lt;class T&gt; class shared_ptr {
  public:
...
    // 20.9.11.2.3, assignment:
    shared_ptr&amp; operator=(const shared_ptr&amp; r)<ins> noexcept</ins>;
    template&lt;class Y&gt; shared_ptr&amp; operator=(const shared_ptr&lt;Y&gt;&amp; r)<ins> noexcept</ins>;
    shared_ptr&amp; operator=(shared_ptr&amp;&amp; r)<ins> noexcept</ins>;
    template&lt;class Y&gt; shared_ptr&amp; operator=(shared_ptr&lt;Y&gt;&amp;&amp; r)<ins> noexcept</ins>;
...
    void reset()<ins> noexcept</ins>;
...
  };
...
}
</pre>

<h2>20.9.11.2.3 shared_ptr assignment</h2>

Before p. 1
<pre>
shared_ptr&amp; operator=(const shared_ptr&amp; r)<ins> noexcept</ins>;
template&lt;class Y&gt; shared_ptr&amp; operator=(const shared_ptr&lt;Y&gt;&amp; r)<ins> noexcept</ins>;
template&lt;class Y&gt; shared_ptr&amp; operator=(auto_ptr&lt;Y&gt;&amp;&amp; r);
</pre>

After p. 3
<pre>
shared_ptr&amp; operator=(shared_ptr&amp;&amp; r)<ins> noexcept</ins>;
template&lt;class Y&gt; shared_ptr&amp; operator=(shared_ptr&lt;Y&gt;&amp;&amp; r)<ins> noexcept</ins>;
</pre>

<h2>20.9.11.2.4 shared_ptr modifiers</h2>

After p. 2
<pre>void reset()<ins> noexcept</ins>;</pre>

<h2>20.9.11.3 Class template weak_ptr</h2>

After p. 1
<pre>
namespace std {
  template&lt;class T&gt; class weak_ptr {
  public:
...
    void reset()<ins> noexcept</ins>;
...
  };
}
</pre>

<h2>20.9.11.3.4 weak_ptr modifiers</h2>

After p. 2
<pre>void reset()<ins> noexcept</ins>;</pre>

<h2>20.9.11.5 shared_ptr atomic access</h2>

After p. 5
<pre>
template&lt;class T&gt;
  shared_ptr&lt;T&gt; atomic_load(const shared_ptr&lt;T&gt;* p)<ins> noexcept</ins>;
</pre>

After p. 11
<pre>
template&lt;class T&gt;
  void atomic_store(shared_ptr&lt;T&gt;* p, shared_ptr&lt;T&gt; r)<ins> noexcept</ins>;
</pre>

After p. 17
<pre>
template&lt;class T&gt;
shared_ptr&lt;T&gt; atomic_exchange(shared_ptr&lt;T&gt;* p, shared_ptr&lt;T&gt; r)<ins> noexcept</ins>;
</pre>

After p. 23
<pre>
template&lt;class T&gt;
  bool atomic_compare_exchange_weak(
    shared_ptr&lt;T&gt;* p, shared_ptr&lt;T&gt;* v, shared_ptr&lt;T&gt; w)<ins> noexcept</ins>;
</pre>

After p. 25
<pre>
template&lt;class T&gt;
  bool atomic_compare_exchange_strong(
    shared_ptr&lt;T&gt;* p, shared_ptr&lt;T&gt;* v, shared_ptr&lt;T&gt; w)<ins> noexcept</ins>;
</pre>

<h2>20.9.13 Align</h2>

Before p. 1
<pre>
void *align(std::size_t alignment, std::size_t size,
  void *&amp;ptr, std::size_t&amp; space)<ins> noexcept</ins>;
</pre>

<h2>20.10 Class scoped_allocator</h2>

Modify p. 1
<pre>
// scoped allocator adaptor
template &lt;class OuterAlloc, class... InnerAlloc&gt;
  class scoped_allocator_adaptor;
template &lt;class OuterA1, class OuterA2, class... InnerAllocs&gt;
  bool operator==(const scoped_allocator_adaptor&lt;OuterA1, InnerAllocs...&gt;&amp; a,<del>)</del>
		  const scoped_allocator_adaptor&lt;OuterA2, InnerAllocs...&gt;&amp; b)<ins> noexcept</ins>;
template &lt;class OuterA1, class OuterA2, class... InnerAllocs&gt;
  bool operator!=(const scoped_allocator_adaptor&lt;OuterA1, InnerAllocs...&gt;&amp; a,<del>)</del>
		  const scoped_allocator_adaptor&lt;OuterA2, InnerAllocs...&gt;&amp; b)<ins> noexcept</ins>;
</pre>

After p. 2
<pre>
namespace std {
  template &lt;class OuterAlloc, class... InnerAllocs&gt;
    class scoped_allocator_adaptor : public OuterAlloc {
...
    template &lt;class OuterA2&gt;<del>}</del>
      scoped_allocator_adaptor(OuterA2&amp;&amp; outerAlloc,
                               const InnerAllocs&amp;... innerAllocs)<ins> noexcept;</ins>
    scoped_allocator_adaptor(const scoped_allocator_adaptor&amp; other)<ins> noexcept</ins>;
    template &lt;class OuterA2&gt;
      scoped_allocator_adaptor(const scoped_allocator_adaptor&lt;OuterA2, InnerAllocs...&gt;&amp; other)<ins> noexcept</ins>;
    template &lt;class OuterA2&gt;
      scoped_allocator_adaptor(const scoped_allocator_adaptor&lt;OuterA2, InnerAllocs...&gt;&amp;&amp; other)<ins> noexcept</ins>;
...
    inner_allocator_type&amp; inner_allocator()<ins> noexcept</ins>;
    const inner_allocator_type&amp; inner_allocator() const<ins> noexcept</ins>;
    outer_allocator_type&amp; outer_allocator()<ins> noexcept</ins>;
    const outer_allocator_type&amp; outer_allocator() const<ins> noexcept</ins>;
...
    void deallocate(pointer p, size_type n)<ins> noexcept</ins>;
...
  };
template &lt;class OuterA1, class OuterA2, class... InnerAllocs&gt;
  bool operator==(const scoped_allocator_adaptor&lt;OuterA1, InnerAllocs...&gt;&amp; a,
                  const scoped_allocator_adaptor&lt;OuterA2, InnerAllocs...&gt;&amp; b)<ins> noexcept</ins>;
template &lt;class OuterA1, class OuterA2, class... InnerAllocs&gt;
  bool operator!=(const scoped_allocator_adaptor&lt;OuterA1, InnerAllocs...&gt;&amp; a,
                  const scoped_allocator_adaptor&lt;OuterA2, InnerAllocs...&gt;&amp; b)<ins> noexcept</ins>;
}
</pre>

<h2>20.10.2 Scoped allocator adaptor constructors</h2>

After p. 1
<pre>
template &lt;class OuterA2&gt;
  scoped_allocator_adaptor(OuterA2&amp;&amp; outerAlloc,
                           const InnerAllocs&amp;... innerAllocs)<ins> noexcept<Ins>;
</pre>

After p. 3
<pre>scoped_allocator_adaptor(const scoped_allocator_adaptor&amp; other)<ins> noexcept</ins>;</pre>

After p. 4
<pre>
template &lt;class OuterA2&gt;
  scoped_allocator_adaptor(const scoped_allocator_adaptor&lt;OuterA2,
			   InnerAllocs...&gt;&amp; other)<ins> noexcept</ins>;
</pre>

After p. 6
<pre>
template &lt;class OuterA2&gt;
  scoped_allocator_adaptor(const scoped_allocator_adaptor&lt;OuterA2,
			   InnerAllocs...&gt;&amp;&amp; other)<ins> noexcept</ins>;
</pre>

<h2>20.10.3 Scoped allocator adaptor members</h2>

After p. 1
<pre>
inner_allocator_type&amp; inner_allocator()<ins> noexcept</ins>;
const inner_allocator_type&amp; inner_allocator() const<ins> noexcept</ins>;
</pre>

After p. 2
<pre>
outer_allocator_type&amp; outer_allocator()<ins> noexcept</ins>;
</pre>

After p. 3
<pre>
const outer_allocator_type&amp; outer_allocator() const<ins> noexcept</ins>;
</pre>

After p. 6
<pre>void deallocate(pointer p, size_type n)<ins> noexcept</ins>;</pre>

<h2>20.13.3 type_index members</h2>

Before p. 1
<pre>type_index(const type_info&amp; rhs)<ins> noexcept</ins>;</pre>

After p. 1
<pre>bool operator==(const type_index&amp; rhs) const<ins> noexcept</ins>;</pre>

After p. 2
<pre>bool operator!=(const type_index&amp; rhs) const<ins> noexcept</ins>;</pre>

After p. 3
<pre>bool operator&lt;(const type_index&amp; rhs) const<ins> noexcept</ins>;</pre>

After p. 4
<pre>bool operator&lt;=(const type_index&amp; rhs) const<ins> noexcept</ins>;</pre>

After p. 5
<pre>bool operator&gt;(const type_index&amp; rhs) const<ins> noexcept</ins>;</pre>

After p. 6
<pre>bool operator&gt;=(const type_index&amp; rhs) const<ins> noexcept</ins>;</pre>




</body>
</html>
