<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<style type="text/css">
pre {margin-left:20pt; }
pre > i {
  font-family: "OCR A Extended", "Consolas", "Lucida Console", monospace;
  font-style:italic;
}
code > i {
  font-family: "OCR A Extended", "Consolas", "Lucida Console", monospace;
  font-style:italic;
}
pre > em {
  font-family: "OCR A Extended", "Consolas", "Lucida Console", monospace;
  font-style:italic;
}
code > em {
  font-family: "OCR A Extended", "Consolas", "Lucida Console", monospace;
  font-style:italic;
}
body { color: #000000; background-color: #FFFFFF; }
del { text-decoration: line-through; color: #8B0040; }
ins { text-decoration: underline; color: #005100; }

p.example { margin-left: 2em; }
pre.example { margin-left: 2em; }
div.example { margin-left: 2em; }

code.extract { background-color: #F5F6A2; }
pre.extract { margin-left: 2em; background-color: #F5F6A2;
  border: 1px solid #E1E28E; }

p.function { }
.attribute { margin-left: 2em; }
.attribute dt { float: left; font-style: italic;
  padding-right: 1ex; }
.attribute dd { margin-left: 0em; }

blockquote.std { color: #000000; background-color: #F1F1F1;
  border: 1px solid #D1D1D1;
  padding-left: 0.5em; padding-right: 0.5em; }
blockquote.stddel { text-decoration: line-through;
  color: #000000; background-color: #FFEBFF;
  border: 1px solid #ECD7EC;
  padding-left: 0.5empadding-right: 0.5em; ; }

blockquote.stdins { text-decoration: underline;
  color: #000000; background-color: #C8FFC8;
  border: 1px solid #B3EBB3; padding: 0.5em; }

table { border: 1px solid black; border-spacing: 0px;
  margin-left: auto; margin-right: auto; }
th { text-align: left; vertical-align: top;
  padding-left: 0.4em; 
  padding-right: 0.4em; }
td { text-align: left; vertical-align: top;
  padding-left: 0.4em; 
  padding-right: 0.4em;  }
</style>

<title>Fixes for optional objects</title>
<script src="Fixes%20for%20optional%20objects_files/jquery.js" type="text/javascript"> </script>
<script type="text/javascript">$(function() {
    var next_id = 0
    function find_id(node) {
        // Look down the first children of 'node' until we find one
        // with an id. If we don't find one, give 'node' an id and
        // return that.
        var cur = node[0];
        while (cur) {
            if (cur.id) return curid;
            if (cur.tagName == 'A' && cur.name)
                return cur.name;
            cur = cur.firstChild;
        };
        // No id.
        node.attr('id', 'gensection-' + next_id++);
        return node.attr('id');
    };

    // Put a table of contents in the #toc nav.

    // This is a list of <ol> elements, where toc[N] is the list for
    // the current sequence of <h(N+2)> tags. When a header of an
    // existing level is encountered, all higher levels are popped,
    // and an <li> is appended to the level
    var toc = [$("<ol/>")];
    $(':header').not('h1').each(function() {
        var header = $(this);
        // For each <hN> tag, add a link to the toc at the appropriate
        // level.  When toc is one element too short, start a new list
        var levels = {H2: 0, H3: 1, H4: 2, H5: 3, H6: 4};
        var level = levels[this.tagName];
        if (typeof level == 'undefined') {
            throw 'Unexpected tag: ' + this.tagName;
        }
        // Truncate to the new level.
        toc.splice(level + 1, toc.length);
        if (toc.length < level) {
            // Omit TOC entries for skipped header levels.
            return;
        }
        if (toc.length == level) {
            // Add a <ol> to the previous level's last <li> and push
            // it into the array.
            var ol = $('<ol/>')
            toc[toc.length - 1].children().last().append(ol);
            toc.push(ol);
        }
        var header_text = header.text();
        toc[toc.length - 1].append(
            $('<li/>').append($('<a href="#' + find_id(header) + '"/>')
                              .text(header_text)));
    });
    $('#toc').append(toc[0]);
})
</script>
</head>

<body>


<!--<table>
<tr><td>Doc. no.</td><td>NXXXX=XX-XXXX</td></tr>
<tr><td>Date</td><td>YYYY-MM-DD</td></tr>
<tr><td valign='top'>Authors</td><td>Fernando Cacciola<br>Andrzej Krzemie&#x144;ski</td><br>Ville Voutilainen</tr>
<tr><td valign='top'>Contact</td><td><a href="mailto:fernando.cacciola@gmail.com">fernando.cacciola@gmail.com</a><br><a href='mailto:akrzemi1@gmail.com'>akrzemi1@gmail.com</a><br><a href='mailto:ville.voutilainen@gmail.com'>ville.voutilainen@gmail.com</a></td></tr>
<tr><td>Addresses</td><td>LWG</td></tr>
</table>-->

<h1><a name="title">Fixes for optional objects</a></h1>

<p>
ISO/IEC JTC1 SC22 WG21 N4078 2014-06-20
</p>

<address>
Fernando Cacciola, fernando.cacciola@gmail.com
</address>
<address>
Andrzej Krzemie&#324;ski, akrzemi1@gmail.com

</address>
<address>
Ville Voutilainen, ville.voutilainen@gmail.com

</address>


<p>Project: Programming Language C++, fundamentals-ts</p>


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

<p>This document proposes a number of wording fixes, as suggested in Issaquah meeting, to optional objects proposed in <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3793.html">N3793</a>. In addition, this document includes the feature additions from <a href="http://open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3982.html">N3982</a> and the review feedback from the LWG sessions in the Rapperswil 2014 meeting.</p>

<ul>
<li>Got rid of terms 'engaged' and 'disengaged'; now using term 'contains a value' instead.</li>
<li>Using term 'direct-non-list-initialization'; it was missing in a number of places.</li>
<li>Now using alias template <code>decay_t</code> in place of the old type trait.</li>
<li>Changed the conditions under which function <code>value_or</code> shall be <code>costexpr</code>.</li>
<li>Fixed spelling and grammar mistakes.</li>
<li>Rvalue reference overloads now return prvalues rather than xvalues (T rather than T&amp;&amp;).</li>
<li>Rvalue reference overloads for const T&amp;&amp; added.</li>
<li>Review corrections based on LWG review.</li>
</ul>

<h2><a name="toc">Table of contents</a></h2>

<p id="toc"><ol><li><a href="#intro">Introduction</a></li><li><a href="#toc">Table of contents</a></li><li><a href="#wording">Proposed wording</a></li><li><a href="#acknowledgements">Acknowledgements</a></li></ol></p>



<h2><a name="wording">Proposed wording</a></h2>

<p>The insertions and deletions in this section describe the changes to 
Fundamentals TS after applying the changes from N3793. In other words, 
the changes are relative to N3793.</p>

Change [optional.synop]:

<blockquote class="std"> 
<pre>    // <em><a href="#optional.object.observe">5.4.5</a>, observers</em>
    constexpr T const* operator -&gt;() const;
    <ins>constexpr</ins> T* operator -&gt;();
    constexpr T const&amp; operator *() const<ins>&amp;</ins>;
    <ins>constexpr</ins> T&amp; operator *() <ins>&amp;</ins>;
    <ins>constexpr T operator *() &amp;&amp;;</ins>
    <ins>constexpr T operator *() const&amp;&amp;;</ins>
    constexpr explicit operator bool() const noexcept;
    constexpr T const&amp; value() const<ins>&amp;</ins>;
    <ins>constexpr</ins> T&amp; value() <ins>&amp;</ins>;
    <ins>constexpr T value() &amp;&amp;;</ins>
    <ins>constexpr T value() const&amp;&amp;;</ins>
    template &lt;class U&gt; constexpr T value_or(U&amp;&amp;) const&amp;;
    template &lt;class U&gt; <ins>constexpr</ins> T value_or(U&amp;&amp;) &amp;&amp;;
</pre>
</blockquote>

<blockquote class="std"> 
<pre>  // <em><a href="#optional.inplace">5.5</a>, In-place construction</em>
  struct in_place_t{};
  constexpr in_place_t in_place{};

  // <em><a href="#optional.nullopt">5.6</a>, <del>Disengaged</del><ins>No-value</ins> state indicator</em>
  struct nullopt_t{<em>see below</em>};
  constexpr nullopt_t nullopt(<em>unspecified</em>);
  
  // <em><a href="#optional.bad_optional_access">5.7</a>, class bad_optional_access</em>
  class bad_optional_access;</pre>
</blockquote>

<blockquote class="std"> 
<pre>  <var>private:</var>
    <del><var>bool init; //</var> <em>exposition only</em></del>
    <var>T*   val;  //</var> <em>exposition only</em>
  };
</pre>
</blockquote>

Replace [optional.object], para 1 and 2 with the following

<blockquote class="std">

<p><ins>Any instance of <code>optional&lt;T&gt;</code> at any given time either <em>contains a value</em> or <em>does not contain a value</em>. When an instance of <code>optional&lt;T&gt;</code> contains a value, it means that an object of type <code>T</code>, referred to as the optional object's <em>contained value</em>,
 is allocated within the storage of the optional object. Implementations
 are not permitted to use additional storage, such as dynamic memory, to
 allocate its contained value. The contained value shall be allocated in
 a region of the <code>optional&lt;T&gt;</code> storage suitably aligned for the type <code>T</code>. When an object of type <code>optional&lt;T&gt;</code> is 
contextually converted to <code>bool</code>, the conversion returns <code>true</code> if the object contains a value; otherwise the conversion returns <code>false</code>.
</ins></p></blockquote>


<blockquote class="std">
<ins>Member <code><var>val</var></code> is provided for exposition only. When an <code>optional&lt;T&gt;</code> object contains a value, <code><var>val</var></code> points to the contained value.</ins>
</blockquote>





<p>Change [optional.object] subclauses as follows:</p>
  

  <blockquote class="std">


<h5><a name="optional.object.ctor">5.4.1 Constructors <span style="float:right">[optional.object.ctor]</span></a></h5>

  
  <p class="function">
  <code>constexpr optional() noexcept;</code><br>
  <code>constexpr optional(nullopt_t) noexcept;</code>
  </p>

  <dl class="attribute">
  <dt>Postconditions:</dt> <dd><p><del><code>*this</code> is disengaged</del><ins><code>*this does not contain a value</code></ins>.</p></dd>
  <dt>Remarks:</dt> <dd><p>No contained value is initialized. For every object type <code>T</code><ins>,</ins> these constructors shall be <code>constexpr</code> constructors (C++11 7.1.5).</p></dd>
  </dl>

  
  <p class="function">
  <code>optional(const optional&lt;T&gt;&amp; <var>rhs</var>);</code>
  </p>

  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>is_copy_constructible&lt;T&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Effects:</dt> <dd><p>If <code><var>rhs</var></code> <del>is engaged </del><ins>contains a value, </ins>initializes the contained value as if direct-non-list-initializing an object of type <code>T</code> with the expression <code>*<var>rhs</var></code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>bool(<var>rhs</var>) == bool(*this)</code>.</p></dd>
    <dt>Throws:</dt> <dd><p>Any exception thrown by the selected constructor of <code>T</code>.</p></dd>
  </dl>
  
  
  <p class="function">
  <code>optional(optional&lt;T&gt; &amp;&amp; <var>rhs</var>) noexcept(<em>see below</em>);</code>
  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>is_move_constructible&lt;T&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Effects:</dt> <dd><p>If <code><var>rhs</var></code> <del>is engaged </del><ins>contains a value, </ins>initializes the contained value as if direct-non-list-initializing an object of type <code>T</code> with the expression <code>std::move(*<var>rhs</var>)</code>. <code>bool(<var>rhs</var>)</code> is unchanged.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>bool(<var>rhs</var>) == bool(*this)</code>.</p></dd>
    <dt>Throws:</dt> <dd><p>Any exception thrown by the selected constructor of <code>T</code>.</p></dd>
    <dt>Remarks:</dt> <dd><p>The expression inside <code>noexcept</code> is equivalent to:</p> <pre>is_nothrow_move_constructible&lt;T&gt;::value</pre></dd>
  </dl>

  
  <p class="function">
  <code>constexpr optional(const T&amp; <var>v</var>);</code>
  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>is_copy_constructible&lt;T&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Effects:</dt> <dd><p>Initializes the contained value as if direct-non-list-initializing an object of type <code>T</code> with the expression <code><var>v</var></code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>*this</code><del> is engaged</del><ins> contains a value</ins>.</p></dd>
    <dt>Throws:</dt> <dd><p>Any exception thrown by the selected constructor of <code>T</code>.</p></dd>
    <dt>Remarks:</dt> <dd><p>If <code>T</code>'s selected constructor is a <code>constexpr</code> constructor, this constructor shall be a <code>constexpr</code> constructor.</p></dd>
  </dl>
  
  
  <p class="function">
  <code>constexpr optional(T&amp;&amp; <var>v</var>);</code>
  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>is_move_constructible&lt;T&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Effects:</dt> <dd><p>Initializes the contained value as if direct-non-list-initializing an object of type <code>T</code> with the expression <code>std::move(<var>v</var>)</code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>*this</code><del> is engaged</del><ins> contains a value</ins>.</p></dd>
    <dt>Throws:</dt> <dd><p>Any exception thrown by the selected constructor of <code>T</code>.</p></dd>
    <dt>Remarks:</dt> <dd><p>If <code>T</code>'s selected constructor is a <code>constexpr</code> constructor, this constructor shall be a <code>constexpr</code> constructor.</p></dd>
  </dl>
  
  <p class="function">
  <code>template &lt;class... Args&gt; constexpr explicit optional(in_place_t, Args&amp;&amp;... <var>args</var>);</code>
  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>is_constructible&lt;T, Args&amp;&amp;...&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Effects:</dt> <dd><p>Initializes the contained value as if direct-non-list-initializing an object of type <code>T</code> with the arguments <code>std::forward&lt;Args&gt;(<var>args</var>)...</code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>*this</code><del> is engaged</del><ins> contains a value</ins>.</p></dd>
    <dt>Throws:</dt> <dd><p>Any exception thrown by the selected constructor of <code>T</code>.</p></dd>
    <dt>Remarks:</dt> <dd><p>If <code>T</code>'s constructor selected for the initialization is a <code>constexpr</code> constructor, this constructor shall be a <code>constexpr</code> constructor.</p></dd>
  </dl>


  <p class="function">
  <code>template &lt;class U, class... Args&gt;<br>
  constexpr explicit optional(in_place_t, initializer_list&lt;U&gt; <var>il</var>, Args&amp;&amp;... <var>args</var>);</code>
  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>is_constructible&lt;T, initializer_list&lt;U&gt;&amp;, Args&amp;&amp;...&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Effects:</dt> <dd><p>Initializes the contained value as if direct-non-list-initializing an object of type <code>T</code> with the arguments <code><var>il</var>, std::forward&lt;Args&gt;(<var>args</var>)...</code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>*this</code><del> is engaged</del><ins> contains a value</ins>.</p></dd>
    <dt>Throws:</dt> <dd><p>Any exception thrown by the selected constructor of <code>T</code>.</p></dd>
    <dt>Remarks:</dt> <dd><p>The function shall not participate in overload resolution unless <code>is_constructible&lt;T, initializer_list&lt;U&gt;&amp;, Args&amp;&amp;...&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Remarks:</dt> <dd><p>If <code>T</code>'s constructor selected for the initialization is a <code>constexpr</code> constructor, this constructor shall be a <code>constexpr</code> constructor.</p></dd>
  </dl>


<h5><a name="optional.object.dtor">5.4.2 Destructor  <span style="float:right">[optional.object.dtor]</span></a></h5>
  
  <p class="function"> 
  <code>~optional();</code>
  </p>
  
  <dl class="attribute">
    <dt>Effects:</dt> <dd><p>If <code>is_trivially_destructible&lt;T&gt;::value != true</code> and <code>*this</code><del> is engaged</del><ins> contains a value</ins>, calls <code><var>val</var>-&gt;T::~T()</code>.</p></dd>
    <dt>Remarks:</dt> <dd><p>If <code>is_trivially_destructible&lt;T&gt;::value == true</code> then this destructor shall be a trivial destructor.</p></dd>
  </dl>
  
  
<h5><a name="optional.object.assign">5.4.3 Assignment  <span style="float:right">[optional.object.assign]</span></a></h5>
  
  
  <p class="function">
  <code>optional&lt;T&gt;&amp; operator=(nullopt_t) noexcept;</code>
  </p>

  <dl class="attribute">
    <dt>Effects:</dt> <dd><p>If <code>*this</code><del> is engaged</del><ins> contains a value,</ins> calls <code><var>val</var>-&gt;T::~T()</code> to destroy the contained value; otherwise no effect.</p></dd>
    <dt>Returns:</dt> <dd><p><code>*this</code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>*this</code><del> is disengaged</del><ins> does not contain a value</ins>.</p></dd>
  </dl>
  
 
  <p class="function">
  <code>optional&lt;T&gt;&amp; optional&lt;T&gt;::operator=(const optional&lt;T&gt;&amp; <var>rhs</var>);</code>
  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>is_copy_constructible&lt;T&gt;::value</code> is <code>true</code> and <code>is_copy_assignable&lt;T&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Effects:</dt><br><br><ins>
      <table border=1>
	<tr><th></th><th><code>*this</code> contains a value</th><th><code>*this</code> does not contain a value</th>
	  </tr>
	<tr><td><b><code>rhs</code> contains a value</b></td>
	  <td>assigns <code>*rhs</code> to the contained value</td>	  
	  <td>initializes the contained value as if direct-non-list-initializing an object of type <code>T</code> with <code>*rhs</code></td>
          </tr>

	<tr><td><b><code>rhs</code> does not contain a value</b></td>
	  <td>destroys the contained value by calling <code>val->T::~T()</code></td>
	  <td>no effect</td>

	</tr>
      </table></ins>
	<del><dd><br><ul>
	  <li>If <code>*this</code> is disengaged and <code><var>rhs</var></code> is disengaged, no effect, otherwise</li> 
	  <li>if <code>*this</code> is engaged and <code><var>rhs</var></code> is disengaged, destroys the contained value by calling <code><var>val</var>-&gt;T::~T()</code>, otherwise</li>
	  <li>if <code>*this</code> is disengaged and <code><var>rhs</var></code> is engaged, initializes the contained value as if direct-non-list-initializing an object of type <code>T</code> with <code>*<var>rhs</var></code>, otherwise</li>
	  <li>(if both <code>*this</code> and <code><var>rhs</var></code> are engaged) assigns <code>*<var>rhs</var></code> to the contained value.</li>
	  </ul></dd></del><br>
    <dt>Returns:</dt> <dd><p><code>*this</code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>bool(<var>rhs</var>) == bool(*this)</code>.</p></dd>
    <dt><ins>Remarks:</ins><del>Exception Safety:</del></dt> <dd><p>If any exception is thrown, the <ins>result of the expression</ins><del>values</del> <ins><code>bool(*this)</code></ins><del> of <code><var>init</var></code> and <code><var>rhs.init</var></code></del> remain<ins>s</ins> unchanged. If an exception is thrown during the call to <code>T</code>'s copy constructor, no effect. If an exception is thrown during the call to <code>T</code>'s copy assignment, the state of its contained value is as defined by the exception safety guarantee of <code>T</code>'s copy assignment.</p></dd>
  </dl>
  
 
  <p class="function">
  <code>optional&lt;T&gt;&amp; optional&lt;T&gt;::operator=(optional&lt;T&gt;&amp;&amp; <var>rhs</var>) noexcept(<em>see below</em>);</code>
  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>is_move_constructible&lt;T&gt;::value</code> is <code>true</code> and <code>is_move_assignable&lt;T&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Effects:</dt><br><br><ins><ins><dd><p>The result of the expression <code>bool(rhs)</code> remains unchanged.</p></dd></ins>
      <table border=1>
	<tr><th></th><th><code>*this</code> contains a value</th><th><code>*this</code> does not contain a value</th>
	  </tr>
	<tr><td><b><code>rhs</code> contains a value</b></td>
	  <td>assigns <code>move(*rhs)</code> to the contained value</td>
	  <td>initializes the contained value as if direct-non-list-initializing an object of type <code>T</code> with <code>move(*rhs)</code></td>
        </tr>
	<tr><td><b><code>rhs</code> does not contain a value</b></td>
	  <td>destroys the contained value by calling <code>val->T::~T()</code></td>	  
	  <td>no effect</td>
	  
	</tr>
      </table></ins>
	<del><dd><br><ul>
	  <li>If <code>*this</code> is disengaged and <code><var>rhs</var></code> is disengaged, no effect, otherwise</li> 
	  <li>if <code>*this</code> is engaged and <code><var>rhs</var></code> is disengaged, destroys the contained value by calling <code><var>val</var>-&gt;T::~T()</code>, otherwise</li>
	  <li>if <code>*this</code> is disengaged and <code><var>rhs</var></code> is engaged, initializes the contained value as if direct-non-list-initializing an object of type <code>T</code> with <code>std::move(*<var>rhs</var>)</code>, otherwise</li>
	  <li>(if both <code>*this</code> and <code><var>rhs</var></code> are engaged) assigns <code>std::move(*<var>rhs</var>)</code> to the contained value.</li>
	  </ul></dd></del><br>
    <dt>Returns:</dt> <dd><p><code>*this</code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>bool(<var>rhs</var>) == bool(*this)</code>.</p></dd>

    <dt>Remarks:</dt> <dd><p>The expression inside <code>noexcept</code> is equivalent to:</p> <pre>is_nothrow_move_assignable&lt;T&gt;::value &amp;&amp; is_nothrow_move_constructible&lt;T&gt;::value</pre></dd>
    <dt><del>Exception Safety:</del></dt> <dd><p> If any exception is thrown, the <ins>result of the expression</ins><del>values</del> <ins><code>bool(*this)</code></ins><del> of <code><var>init</var></code> and <code><var>rhs.init</var></code></del> remain<ins>s</ins> unchanged. If an exception is thrown during the call to <code>T</code>'s move constructor, the state of <code>*rhs.val</code> is determined by <ins>the</ins>exception safety guarantee of <code>T</code>'s move constructor. If an exception is thrown during the call to <code>T</code>'s move assignment, the state of <code><var>*val</var></code> and <code>*rhs.val</code> is determined by <ins>the </ins>exception safety guarantee of <code>T</code>'s move assignment.</p></dd>

  </dl>
  
  
  <p class="function">
  <code>template &lt;class U&gt; optional&lt;T&gt;&amp; optional&lt;T&gt;::operator=(U&amp;&amp; <var>v</var>);</code>
  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>is_constructible&lt;T, U&gt;::value</code> is <code>true</code> and <code>is_assignable&lt;T&amp;, U&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Effects:</dt> <dd><p>If <code>*this</code><del> is engaged</del><ins> contains a value,</ins> assigns <code>std::forward&lt;U&gt;(<var>v</var>)</code> to the contained value; otherwise initializes the contained value as if direct-non-list-initializing object of type <code>T</code> with <code>std::forward&lt;U&gt;(<var>v</var>)</code>.</p></dd>
    <dt>Returns:</dt> <dd><p><code>*this</code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>*this</code><del> is engaged</del><ins> contains a value</ins>.</p></dd>
    <dt><ins>Remarks:</ins><del>Exception Safety:</del></dt> <dd><p>If any exception is thrown, <ins>the result of the expression</ins><del>value</del> <ins><code>bool(*this)</code></ins><del>of <code><var>init</var></code></del> remains unchanged. If an exception is thrown during the call to <code>T</code>'s constructor, the state of <code><var>v</var></code> is determined by <ins>the </ins>exception safety guarantee of <code>T</code>'s constructor. If an exception is thrown during the call to <code>T</code>'s assignment, the state of <code><var>*val</var></code> and <code><var>v</var></code> is determined by <ins>the </ins>exception safety guarantee of <code>T</code>'s assignment.</p></dd>
    <dt><del>Remarks:</del></dt> <dd><p>The function shall not participate in overload resolution unless  <code>is_same&lt;<del>typename decay&lt;U&gt;::type</del><ins>decay_t&lt;U&gt;, T&gt;::value</ins></code> is  <code>true</code>.</p></dd>
  </dl>
  <p>[<i>Note:</i> The reason to provide such generic assignment and then constraining it so that effectively <code>T</code> == <code>U</code> is to guarantee that assignment of the form <code>o = {}</code> is unambiguous. <i>end note</i>]</p>

  
  <p class="function">
  <code>template &lt;class... Args&gt; void optional&lt;T&gt;::emplace(Args&amp;&amp;... <var>args</var>);</code>
  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>is_constructible&lt;T, Args&amp;&amp;...&gt;::value</code> is <code>true</code>.</p></dd>
    <dt>Effects:</dt> <dd><p>Calls <code>*this = nullopt</code>. Then initializes the contained value as if <del>constructing</del><ins>direct-non-list-initializing</ins> an object of type <code>T</code> with the arguments <code>std::forward&lt;Args&gt;(<var>args</var>)...</code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>*this</code><del> is engaged</del><ins> contains a value</ins>.</p></dd>
    <dt>Throws:</dt> <dd><p>Any exception thrown by the selected constructor of <code>T</code>.</p></dd>
    <dt><ins>Remarks:</ins><del>Exception Safety:</del></dt> <dd><p>If an exception is thrown during the call to <code>T</code>'s constructor, <code>*this</code> <del>is disengaged</del><ins>does not contain a value</ins>, and the previous <code><var>*val</var></code> (if any) has been destroyed.</p></dd>

  </dl>
  
  
   <p class="function">
  <code>template &lt;class U, class... Args&gt; void optional&lt;T&gt;::emplace(initializer_list&lt;U&gt; <var>il</var>, Args&amp;&amp;... <var>args</var>);</code>
  </p>
  
  <dl class="attribute">
    <del>
    <dt><del>Requires:</del></dt> <dd><p><code>is_constructible&lt;T, initializer_list&lt;U&gt;&amp;, Args&amp;&amp;...&gt;::value</code> is <code>true</code>.</p></dd>
    </del>
    <dt>Effects:</dt> <dd><p>Calls <code>*this = nullopt</code>. Then initializes the contained value as if <del>constructing</del><ins>direct-non-list-initializing</ins> an object of type <code>T</code> with the arguments <code><var>il</var>, std::forward&lt;Args&gt;(<var>args</var>)...</code>.</p></dd>
    <dt>Postconditions:</dt> <dd><p><code>*this</code><del> is engaged</del><ins> contains a value</ins>.</p></dd>
    <dt>Throws:</dt> <dd><p>Any exception thrown by the selected constructor of <code>T</code>.</p></dd>
    <dt><ins>Remarks:</ins><del>Exception Safety:</del></dt> <dd><p>If an exception is thrown during the call to <code>T</code>'s constructor, <code>*this</code> <del>is disengaged</del><ins>does not contain a value</ins>, and the previous <code><var>*val</var></code> (if any) has been destroyed.</p></dd>
    <dt><del>Remarks:</del></dt> <dd><p>The function shall not participate in overload resolution unless <code>is_constructible&lt;T, initializer_list&lt;U&gt;&amp;, Args&amp;&amp;...&gt;::value</code> is <code>true</code>.</p></dd>
  </dl>


  
<h5><a name="optional.object.swap">5.4.4 Swap <span style="float:right">[optional.object.swap]</span></a></h5>


  <p class="function">
  <code>void optional&lt;T&gt;::swap(optional&lt;T&gt;&amp; rhs) noexcept(<em>see below</em>);</code>
  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> L<del>V</del><ins>v</ins>alues of type <del>T</del><ins><code>T</code></ins> shall be swappable and <code>is_move_constructible&lt;T&gt;::value</code> is <code>true</code>.<p></p>
    <dt>Effects:</dt><br><br><ins>
      <table border=1>
	<tr><th></th><th><code>*this</code> contains a value</th><th><code>*this</code> does not contain a value</th>
	  </tr>
	<tr><td><b><code>rhs</code> contains a value</b></td>
	  <td>calls <code>swap(*(*this), *<var>rhs</var>)</code></td>	  
	  <td>initializes the contained value of <code>*this</code> as if direct-non-list-initializing an object of type <code>T</code> with the expression <code>std::move(*<var>rhs</var>)</code>, followed by <code>rhs.val-&gt;T::~T()</code>; postcondition is that <code>*this</code> contains a value and <code><var>rhs</var></code> does not contain a value</td>
          </tr>
	<tr><td><b><code>rhs</code> does not contain a value</b></td>
	  <td>initializes the contained value of <code><var>rhs</var></code> as if direct-non-list-initializing an object of type <code>T</code> with the expression <code>std::move(*(*this))</code>, followed by <code>val-&gt;T::~T()</code>; postcondition is that <code>*this</code> does not contain a value and <code><var>rhs</var></code> contains a value</td>

	  <td>no effect</td>
	</tr>
    </table></ins>
    <del><dd><br><ul>
	<li>If <code>*this</code> is disengaged and <code><var>rhs</var></code> is disengaged, no effect, otherwise</li> 
	<li>if <code>*this</code> is engaged and <code><var>rhs</var></code> is disengaged, initializes the contained value of <code><var>rhs</var></code> by direct-initialization with <code>std::move(*(*this))</code>, followed by <code>val-&gt;T::~T(), swap(<var>init</var>, <var>rhs.init</var>)</code>, otherwise</li>
	<li>if <code>*this</code> is disengaged and <code><var>rhs</var></code> is engaged, initializes the contained value of <code>*this</code> by direct-initialization with <code>std::move(*<var>rhs</var>)</code>, followed by <code>rhs.val-&gt;T::~T(), swap(<var>init</var>, <var>rhs.init</var>)</code></li>
	<li>(if both <code>*this</code> and <code><var>rhs</var></code> are engaged) calls <code>swap(*(*this), *<var>rhs</var>)</code>.</li>
    </ul></dd></del><br>
    <dt>Throws:</dt> <dd><p>Any exceptions that the expressions in the Effects <ins>element</ins><del>clause</del> throw.</p></dd>
    <dt>Remarks:</dt> <dd><p>The expression inside <code>noexcept</code> is equivalent to: </p><pre>is_nothrow_move_constructible&lt;T&gt;::value &amp;&amp; noexcept(swap(declval&lt;T&amp;&gt;(), declval&lt;T&amp;&gt;()))</pre></dd>
    <dt><del>Exception Safety:</del></dt> <dd><p>If any exception is thrown, <ins>the results of the expressions </ins><del>values</del> <del>of <code><var>init</var></code> and <code><var>rhs.init</var></code></del><ins><code>bool(*this)</code> and <code>bool(<var>rhs</var>)</code></ins> remain unchanged. If an exception is thrown during the call to function <code>swap</code> the state of <code><var>*val</var></code> and <code>*rhs.val</code> is determined by the exception safety guarantee of <code>swap</code> for lvalues of <code>T</code>. If an exception is thrown during the call to <code>T</code>'s move constructor, the state of <code><var>*val</var></code> and <code>*rhs.val</code> is determined by the exception safety guarantee of <code>T</code>'s move constructor.</p></dd>

  </dl>

  
  
<h5><a name="optional.object.observe">5.4.5 Observers  <span style="float:right">[optional.object.observe]</span></a></h5>


  <p class="function">
  <code>constexpr T const* operator-&gt;() const;<br><ins>constexpr</ins> T* operator-&gt;();</code>

  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>*this</code><del> is engaged</del><ins> contains a value</ins>.</p></dd>
    <dt>Returns:</dt> <dd><p><code><var>val</var></code>.</p></dd>
    <dt>Throws:</dt> <dd><p>Nothing.</p></dd>
    <dt>Remarks:</dt> <dd><p>Unless <code>T</code> is a user-defined type with overloaded unary <code>operator&amp;</code>, <del>the first function</del><ins>these functions</ins> shall be <del>a </del><code>constexpr</code> function<ins>s</ins>.</p></dd>
  </dl>
  
  
  <p class="function">
  <code>constexpr T const&amp; operator*() const<ins>&amp;</ins>;<br><ins>constexpr </ins>T&amp; operator*()<ins> &amp;</ins>;</code>

  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>*this</code><del> is engaged</del><ins> contains a value</ins></p></dd>
    <dt>Returns:</dt> <dd><p><code>*<var>val</var></code>.</p></dd>
    <dt>Throws:</dt> <dd><p>Nothing.</p></dd>
    <dt>Remarks:</dt> <dd><p><del>The first function</del><ins>These functions</ins> shall be <del>a </del><code>constexpr</code> function<ins>s</ins>.</p></dd>

  </dl>
<ins>
  <p class="function">
  <code>constexpr T operator*() &amp;&amp;;<br>constexpr T operator*() const&amp;&amp;;</code>

  </p>
  
  <dl class="attribute">
    <dt>Requires:</dt> <dd><p><code>*this</code> contains a value</p></dd>
    <dt>Effects:</dt> <dd><p>equivalent to <code>return std::move(*<var>val</var>);</code></p></dd>
    <dt>Remarks:</dt> <dd><p>if <code>is_move_constructible&lt;T&gt;::value</code> is <code>false</code>, the program is ill-formed.</p></dd>
  </dl>
</ins>  
  
  <p class="function">
  <code>constexpr explicit operator bool() noexcept;</code>
  </p>
  
  <dl class="attribute">
    <dt>Returns:</dt> <dd><p><del><code><var>init</var></code></del><ins><code>true</code> if and only if <code>*this</code> contains a value</ins>.</p></dd>
    <dt>Remarks:</dt> <dd><p>This function shall be a <code>constexpr</code> function.</p></dd>
  </dl>
  
  
  <p class="function">
  <code>constexpr T const&amp; value() const<ins>&amp;</ins>;<br><ins>constexpr </ins>T&amp; value()<ins> &amp;</ins>;</code>
  </p>
  
  <dl class="attribute">
    <ins>
    <dt>Effects:</dt> <dd><p>equivalent to <code>return bool(*this) ? *val : throw bad_optional_access();</code></p></dd>
    </ins>
    <del>
    <dt><del>Returns:</del></dt> <dd><p><code><var>*val</var></code>, if <code>bool(*this)</code>.</p></dd>
    <dt><del>Throws:</del></dt> <dd><p><code>bad_optional_access</code> if <code>!*this</code>.</p></dd>
    <dt><del>Remarks:</del></dt> <dd><p>The first function shall be a <code>constexpr</code> function.</p></dd>
    </del>

  </dl>
  
  <ins>
  <p class="function">
  <code>constexpr T value() &amp;&amp;;<br>constexpr T value() const&amp;&amp;</code>
  </p>
  
  <dl class="attribute">
    <dt>Effects:</dt> <dd><p>equivalent to <code>return bool(*this) ? std::move(*val) : throw bad_optional_access();</code></p></dd>
    <dt>Remarks:</dt> <dd><p>If <code>is_move_constructible&lt;T&gt;::value</code> is <code>false</code>, the program is ill-formed.</p></dd>
  </dl>
  </ins>

  <p class="function">
  <code>template &lt;class U&gt; constexpr T value_or(U&amp;&amp; <var>v</var>) const&amp;;</code>
  </p>
  
  <dl class="attribute">
    <del>
    <dt><del>Requires:</del></dt> <dd><p><code>is_copy_constructible&lt;T&gt;::value</code> is <code>true</code> and <code>is_convertible&lt;U&amp;&amp;, T&gt;::value</code> is <code>true</code>.</p></dd>
    </del>
    <dt><ins>Effects:</ins><del>Returns:</del></dt> <dd><p><ins>equivalent to </ins><code><ins>return </ins>bool(*this) ? *val : static_cast&lt;T&gt;(std::forward&lt;U&gt;(<var>v</var>))</code>.</p></dd>
    <del>
    <dt><del>Throws:</del></dt> <dd><p>Any exception thrown by the selected constructor of <code>T</code>.</p></dd>
    <dt><del>Exception Safety:</del></dt> <dd><p>If <code><var>init</var> == true</code> and exception is thrown during the call to <code>T</code>'s constructor, the value of <code><var>init</var></code> and <code><var>v</var></code> remains unchanged and the state of <code><var>*val</var></code> is determined by the exception safety guarantee of the selected constructor of <code>T</code>. Otherwise, when exception is thrown during the call to <code>T</code>'s constructor, the value of <code><var>*this</var></code> remains unchanged and the state of <code><var>v</var></code> is determined by the exception safety guarantee of the selected constructor of <code>T</code>.</p></dd>
    <dt><del>Remarks:</del></dt> <dd><p>If both constructors of <code>T</code> which could be selected are <code>constexpr </code> constructors, this function shall be a <code>constexpr</code> function.</p></dd>
    </del>
    <ins>
    <dt>Remarks:</dt> <dd><p>If <code>is_copy_constructible&lt;T&gt;::value &amp;&amp; is_convertible&lt;U&amp;&amp;, T&gt;::value</code> is <code>false</code>, the program is ill-formed.</p></dd>
    </ins>
  </dl>
  
  
  <p class="function">
  <code>template &lt;class U&gt; <ins>constexpr</ins> T value_or(U&amp;&amp; <var>v</var>) &amp;&amp;;</code>
  </p>
  
  <dl class="attribute">
    <del>
    <dt><del>Requires:</del></dt> <dd><p><code>is_move_constructible&lt;T&gt;::value</code> is <code>true</code> and <code>is_convertible&lt;U&amp;&amp;, T&gt;::value</code> is <code>true</code>.</p></dd>
    </del>
    <dt><ins>Effects:</ins><del>Returns:</del></dt> <dd><p><ins>equivalent to </ins><code><ins>return </ins>bool(*this) ? std::move(*val) : static_cast&lt;T&gt;(std::forward&lt;U&gt;(<var>v</var>))</code>.</p></dd>
    <del>
    <dt><del>Throws:</del></dt> <dd><p>Any exception thrown by the selected constructor of <code>T</code>.</p></dd>
    <dt><del>Exception Safety:</del></dt> <dd><p>If <code><var>init</var> == true</code> and exception is thrown during the call to <code>T</code>'s constructor, the value of <code><var>init</var></code> and <code><var>v</var></code> remains unchanged and the state of <code><var>*val</var></code> is determined by the exception safety guarantee of the <code>T</code>'s constructor. Otherwise, when exception is thrown during the call to <code>T</code>'s constructor, the value of <code><var>*this</var></code> remains unchanged and the state of <code><var>v</var></code> is determined by the exception safety guarantee of the selected constructor of <code>T</code>.</p></dd>
    </del>
    <ins>
    <dt>Remarks:</dt> <dd><p>If <code>is_move_constructible&lt;T&gt;::value &amp;&amp; is_convertible&lt;U&amp;&amp;, T&gt;::value</code> is <code>false</code>, the program is ill-formed.</p></dd>
    </ins>

  </dl>



<h4><a name="optional.inplace">5.5 In-place construction  <span style="float:right">[optional.inplace]</span></a></h4>


  <p class="function">
  <code>struct in_place_t{}; <br>constexpr in_place_t in_place{};</code>
  </p>

  <p>The struct <code>in_place_t</code> is an empty structure type used as a unique type to disambiguate constructor and function overloading. Specifically, <code>optional&lt;T&gt;</code> has a constructor with <code>in_place_t</code> as the first <ins>parameter</ins><del>argument</del> followed by <ins>a parameter</ins><del>an argument</del> pack; this indicates that <code>T</code> should be constructed in-place (as if by a call to <ins>a</ins> placement new expression) with the forwarded <ins>pack expansion</ins><del>argument pack</del> as <ins>arguments for the initialization of <code>T</code></ins><del>parameters</del>.
  </p>

  
<h4><a name="optional.nullopt">5.6 <del>Disengaged</del><ins>No-value</ins> state indicator  <span style="float:right">[optional.nullopt]</span></a></h4>


  <p class="function">
  <code>struct nullopt_t{<em>see below</em>}; <br>constexpr nullopt_t nullopt(<em>unspecified</em>);</code>
  </p>

  <p>The struct <code>nullopt_t</code> is an empty structure type used as a unique type to indicate <del>a disengaged state</del><ins>the state of not containing a value</ins> for <code>optional</code> objects. In particular, <code>optional&lt;T&gt;</code> has a constructor with <code>nullopt_t</code> as <ins>a</ins> single argument; this indicates that a<ins>n</ins><del> disengaged</del> optional object <ins>not containing a value </ins>shall be constructed.
  </p>
  
  <p>Type <code>nullopt_t</code> shall not have a default constructor. It shall be a literal type. Constant <code>nullopt</code> shall be initialized with an argument of literal type.</p>
  
 
  
<h4><a name="optional.bad_optional_access">5.7 Class <code>bad_optional_access</code>  <span style="float:right">[optional.bad_optional_access]</span></a></h4>
 
<pre>namespace std {
  class bad_optional_access : public logic_error {
  public:<del>
    explicit bad_optional_access(const string&amp; what_arg);
    explicit bad_optional_access(const char* what_arg);</del><ins>
    bad_optional_access();</ins>
  };
}</pre>

<p>The class <code>bad_optional_access</code> defines the type of objects thrown as exceptions to report the situation where an attempt is made to access the value of a<ins>n</ins><del> disengaged</del> optional object<ins> that does not contain a value</ins>.</p>

  <ins><p class="function"> 
  <code>bad_optional_access();</code>
  </p>
  
  <dl class="attribute">
  <dt>Effects:</dt> <dd><p>Constructs an object of class <code>bad_optional_access</code>.</p></dd>
  <dt>Postcondition:</dt> <dd><p><code>what()</code> returns an implementation-defined NTBS.</p></dd>
  </dl></ins>

  <del><p class="function"> 
  <code>bad_optional_access(const string&amp; what_arg);</code>
  </p>
  
  <dl class="attribute">
  <dt>Effects:</dt> <dd><p>Constructs an object of class <code>bad_optional_access</code>.</p></dd>
  <dt>Postcondition:</dt> <dd><p><code>strcmp(what(), what_arg.c_str()) == 0</code>.</p></dd>
  </dl>
  
  <p class="function"> 
  <code>bad_optional_access(const char* what_arg);</code>
  </p>
  
  <dl class="attribute">
  <dt>Effects:</dt> <dd><p>Constructs an object of class <code>bad_optional_access</code>.</p></dd>
  <dt>Postcondition:</dt> <dd><p><code>strcmp(what(), what_arg) == 0</code>.</p></dd>
  </dl></del>

</blockquote>

<p>Change [optional.relops] as follows:</p>

<blockquote class="std"> 
<h4><a name="optional.relops">5.8 Relational operators  <span style="float:right">[optional.relops]</span></a></h4>
 

  <p class="function"> 
  <code>template &lt;class T&gt; constexpr bool operator==(const optional&lt;T&gt;&amp; x, const optional&lt;T&gt;&amp; y);</code>
  </p>
  
  <dl class="attribute">
  <dt>Requires:</dt> <dd><p><code>T</code> shall meet the requirements of <code>EqualityComparable</code>.</p></dd>
  <dt>Returns:</dt> <dd><p>If <code>bool(x) != bool(y)</code>, <code>false</code>; otherwise if <code>bool(x) == false</code>, <code>true</code>; otherwise <code>*x == *y</code>.</p></dd>
  <dt>Remarks:</dt> <dd><p><del>Instantiations</del><ins>Specializations</ins> of this function template<ins>,</ins> for which <code>*x == *y</code> is a core constant expression, shall be <code>constexpr</code> functions.</p></dd>
  </dl>
  
  
  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator!=(const optional&lt;T&gt;&amp; x, const optional&lt;T&gt;&amp; y);</code>
  </p>
  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code>!(x == y)</code>.</p></dd>
  </dl>
  
  
  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator&lt;(const optional&lt;T&gt;&amp; <var>x</var>, const optional&lt;T&gt;&amp; <var>y</var>);</code> 
  </p>

  <dl class="attribute">
  <dt>Requires:</dt> <dd><p><del>Expression </del><code>*<var>x</var> &lt; *<var>y</var></code> shall be well-formed and its result shall be convertible to <code>bool</code>.</p></dd>
  <dt>Returns:</dt> <dd><p>If <code><del>(</del>!<var>y</var><del>)</del></code>, <code>false</code>; otherwise, if <code><del>(</del>!<var>x</var><del>)</del></code>, <code>true</code>; otherwise <code>*<var>x</var> &lt; *<var>y</var></code>.</p></dd>
  <dt>Remarks:</dt> <dd><p><del>Instantiations</del><ins>Specializations</ins> of this function template<ins>,</ins> for which<del> expression</del> <code>*<var>x</var> &lt; *<var>y</var></code> is a core constant expression, shall be <code>constexpr</code> functions.</p></dd>
  </dl>

</blockquote>

<p>Change [optional.nullops] as follows:</p>

<blockquote class="std"> 

 
<h4><a name="optional.nullops">5.9 Comparison with <code>nullopt</code> <span style="float:right">[optional.nullops]</span></a></h4>
 
  
  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator==(const optional&lt;T&gt;&amp; <var>x</var>, nullopt_t) noexcept;<br>template &lt;class T&gt; constexpr bool operator==(nullopt_t, const optional&lt;T&gt;&amp; x) noexcept;</code>
  </p>
  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code><del>(</del>!<var>x</var><del>)</del></code>.</p></dd>
  </dl>
  
  
  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator!=(const optional&lt;T&gt;&amp; <var>x</var>, nullopt_t) noexcept;<br>template &lt;class T&gt; constexpr bool operator!=(nullopt_t, const optional&lt;T&gt;&amp; x) noexcept;</code>
  </p>

  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code>bool(<var>x</var>)</code>.</p></dd>
  </dl> 

  <!-- -->
  
  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator&lt;(const optional&lt;T&gt;&amp; <var>x</var>, nullopt_t) noexcept;</code>
  </p>
  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code>false</code>.</p></dd>
  </dl>

  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator&lt;(nullopt_t, const optional&lt;T&gt;&amp; <var>x</var>) noexcept;</code>
  </p>
  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code>bool(<var>x</var>)</code>.</p></dd>
  </dl>

  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator&lt;=(const optional&lt;T&gt;&amp; <var>x</var>, nullopt_t) noexcept;</code>
  </p>
  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code><del>(</del>!<var>x</var><del>)</del></code>.</p></dd>
  </dl>

  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator&lt;=(nullopt_t, const optional&lt;T&gt;&amp; <var>x</var>) noexcept;</code>
  </p>
  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code>true</code>.</p></dd>
  </dl>
  
  
  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator&gt;(const optional&lt;T&gt;&amp; <var>x</var>, nullopt_t) noexcept;</code>
  </p>
  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code>bool(<var>x</var>)</code>.</p></dd>
  </dl>

  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator&gt;(nullopt_t, const optional&lt;T&gt;&amp; <var>x</var>) noexcept;</code>
  </p>
  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code>false</code>.</p></dd>
  </dl>

  
  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator&gt;=(const optional&lt;T&gt;&amp; <var>x</var>, nullopt_t) noexcept;</code>
  </p>
  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code>true</code>.</p></dd>
  </dl>

  <p class="function">
  <code>template &lt;class T&gt; constexpr bool operator&gt;=(nullopt_t, const optional&lt;T&gt;&amp; <var>x</var>) noexcept;</code>
  </p>
  
  <dl class="attribute">
  <dt>Returns:</dt> <dd><p><code><del>(</del>!<var>x</var><del>)</del></code>.</p></dd>
  </dl>
 
</blockquote>



<h2><a name="acknowledgements">Acknowledgements</a></h2>

<p>Jonathan Wakely reviewed the proposal and offered useful suggestions.</p>

<p>Daniel Krgler provided numerous helpful suggestions, corrections and
 comments on this proposal; in particular he suggested the addition of 
and reference implementation for "perfect initialization" operations.</p>

<p>Many people from the Boost community, participated in the 
developement of the Boost.Optional library. Sebastian Redl suggested the
 usage of function <code>emplace</code>. </p>


<p>Tony Van Eerd offered many useful suggestions and corrections to the proposal.</p>

<p>People in discussion group "ISO C++ Standard - Future Proposals" 
provided numerous insightful suggestions: Vladimir Batov (who described 
and supported the perfect forwarding constructor), Nevin Liber, Ville 
Voutilainen, Richard Smiths, Dave Abrahams, Chris Jefferson, Jeffrey 
Yasskin, Nikolay Ivchenkov, Matias Capeletto, Olaf van der Spek, Vincent
 Jacquet, Kazutoshi Satoda, Vicente J. Botet Escriba, Rbert Dvid, 
Vincent Jacquet, Luc Danton, Greg Marr, and many more. </p>

<p>Joe Gottman suggested the support for hashing some optional objects.</p>

<p>Nicol Bolas suggested to make <code>operator-&gt;</code> conditionally <code>constexpr</code> based on whether <code>T::operator&amp;</code> is overloaded.</p>

  



</body></html>
