<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
    <title>Changes between C++11 and C++14</title>
    <style type="text/css">
      html { margin: 0; padding: 0; color: black; background-color: white; }
      body { padding: 2em; font-size: medium; font-family: "DejaVu Serif", serif; line-height: 150%; }
      code { font-family: "DejaVu Sans Mono", monospace; color: #006; }

      h1, h2, h3 { margin: 1.5em 0 .75em 0; line-height: 125%; }

      sup, sub { line-height: 0; }

      div.code { white-space: pre-line; font-family: "DejaVu Sans Mono", monospace;
                 border: thin solid #E0E0E0; background-color: #F8F8F8; padding: 1em;
                 border-radius: 4px; }

      div.strictpre { white-space: pre; }

      div.code em { font-family: "DejaVu Serif", serif; }

      table { border-top: 2px solid black; border-bottom: 2px solid black; border-collapse: collapse; margin: 0 auto 3em auto; }
      thead th { border-bottom: 2px solid black; }
      tr.midsep td { border-top: 2px solid black; }
      th, td { text-align: left; vertical-align: top; padding: 1ex 1ex 1ex 1em; }
      th:first-child, td:first-child { padding-left: 1ex; }

      tr.new td { background-color: #EFE; }
      td.new:after { content: "new!"; font-family: "DejaVu Sans", sans-serif; font-weight: bold; font-size: xx-small;
                     vertical-align: top; top: -1em; right: -1em; position: relative; float: right; color: #090; }

      table.features { width: 100%; }
      .features tr a { font-family: "DejaVu Sans", sans-serif; text-decoration: none; }
      .features tbody tr { border-bottom: thin solid black; }
      .features tr td:first-child { width: 3em; }
      .features tr td:first-child + td { width: 20%; }
      .features tbody tr:hover { background-color: #F9F9FF; }

      .docinfo { float: right }
      .docinfo p { margin: 0; text-align:right; }
      .docinfo address { font-style: normal; }

      .quote { display: inline-block; clear: both; margin-left: 1ex;
               border: thin solid #E0E0E0; background-color: #F8F8F8; padding: 1ex; }

      /*  Use DIV[insert] and DIV[delete] if the entire paragraph is added or removed; otherwise
       *  use DIV[modify] and use INS/DEL elements to mark up individual changes.
       */

      div.insert { border-left: thick solid #0A0; border-right: thick solid #0A0; padding: 0 1em; }
      div.modify { border-left: thick solid #999; border-right: thick solid #999; padding: 0 1em; }
      div.delete { border-left: thick solid #A00; border-right: thick solid #A00; padding: 0 1em; }

      del { color: #A00; text-decoration: line-through; }
      ins { color: #090; }
      ins code, del code { color: inherit; }

      .box { border: thin black solid; padding: 2px; }

      ol { counter-reset: item; }
      ol > li { counter-increment: item; }
      ol ol { list-style: none; padding: 0; }
      ol ol > li:before { content: counters(item, ".") " "; }
    </style>
  </head>
  <body>
    <div class="docinfo">
      <p>ISO/IEC JTC1 SC22 WG21 P1319R0</p>
      <p>Date: 2018-10-08</p>
      <p>To: the public</p>
      <address>
        Thomas K&ouml;ppe &lt;<a href="mailto:tkoeppe@google.com">tkoeppe@google.com</a>&gt;<br>
      </address>
    </div>

    <h1>Changes between C++11 and C++14</h1>

    <h2>Abstract</h2>

    <p>This document enumerates all the major changes that have been applied to
      the C++ working draft since the publication of C++11, up to the publication
      of C++14. Major changes are those that were added in the form
      of a dedicated paper, although not all papers are mentioned individually. The
      remaining papers are listed summarily below. Issue resolutions from the CWG or
      LWG issues lists are generally not included, but the containing papers are part
      of the summary listing. Defect reports that are not part of the published
      International Standard are marked with a &ldquo;DR&rdquo; superscript.</p>

    <h2>Contents</h2>
    <!-- fgrep -e "<h2 id=" c++14_changes.html | sed -e 's/.*id="\(.*\)">\(.*\)<\/h2>/<li><a href="#\1">\2<\/a><\/li>/g' -->
    <ol>
      <li><a href="#removed">Removed or deprecated features</a></li>
      <li><a href="#new">New features</a></li>
      <li><a href="#modified">Modifications and extensions of existing  features</a></li>
      <li><a href="#misc">Miscellaneous</a></li>
      <li><a href="#unlisted">Unlisted papers</a></li>
    </ol>

<!--

CWG DRs: N3330, N3382, N3383, N3539, N3713, N3833, N3914
LWG DRs: N3318, N3438, N3673, N3522, N3754, N3788, N3930

LWG other: N3346, N3644

CWG974, Default arguments for lambdas (DR)

N3323, Contextual conversions

N3302, constexpr for complex
N3470, constexpr for containers
N3469, constexpr for chrono
N3471, constexpr for utilities

N3472, Binary Literals
N3624, Core Issue 1512: Pointer comparison vs qualification conversions
N3638, Return type deduction for normal functions
N3648, Generalized Lambda-capture
N3653, Member initializers and aggregates
N3667, Drafting for Core 1402
N3652, Relaxing constraints on constexpr functions
N3664, Clarifying Memory Allocation
N3651, Variable Templates
N3649, Generic (Polymorphic) Lambda Expressions

N3760, [[deprecated]] attribute
N3781, Single-Quotation-Mark as a Digit Separator
N3778, C++ Sized Deallocation



N3545, An Incremental Improvement to integral_constant
N3644, Null Forward Iterators
N3668, std::exchange()
N3658, Compile-time integer sequences
N3670, Addressing Tuples by Type
N3671, Making non-modifying sequence operations more robust
N3656, make_unique
N3654, Quoted Strings
N3642, User-defined Literals
N3655 (excluding part 4), TransformationTraits Redux
N3657, Adding heterogeneous comparison lookup to associative containers
N3669, Fixing constexpr member functions without const
N3659, Shared Locking
N3733, Remove gets()
N3779, User-defined Literals for std::complex
N3789, constexpr for functional

N3786, Prohibiting "out of thin air" results in C++14
N3776, Wording for ~future
N3924, Discouraging rand()

N3891, A proposal to rename shared_mutex to shared_timed_mutex
LWG 2288, currently in new status, to the C++14 WP, taking care to rename shared_mutex as in N3891 (if accepted).
N3910, What can signal handlers do? (CWG 1441)
N3927, Definition of lock-free


-->


    <h2 id="removed">Removed or deprecated features</h2>

    <table class="features">
      <thead>
        <tr><th>Document</th><th>Summary</th><th>Examples, notes</th></tr>
      </thead>
      <tbody>
        <tr>
          <td><a href="https://wg21.link/n3733">N3733</a></td>
          <td>Remove <code>gets()</code></td>
          <td>This unsafe I/O function from the C library is no longer available.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3924">N3924</a></td>
          <td>Discourage <code>rand()</code></td>
          <td>This low-quality random number facility from the C library is discouraged in favour of the <code>&lt;random&gt;</code> library.</td>
        </tr>

      </tbody>
    </table>

    <h2 id="new">New features</h2>

    <table class="features">
      <thead>
        <tr><th>Document</th><th>Summary</th><th>Examples, notes</th></tr>
      </thead>
      <tbody>
        <tr>
          <td><a href="https://wg21.link/n3649">N3649</a></td>
          <td>Polymorphic lambdas</td>
          <td>Lambda expressions may now define function templates: <code>[](auto x) { return x * 2; }</code></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3648">N3648</a></td>
          <td>Generalized lambda capture</td>
          <td>Lambda captures may now be initialized: <code>[a = 10, b = std::move(b)](){}</code></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3651">N3651</a></td>
          <td>Variable templates</td>
          <td><code>template &lt;typename T&gt; constexpr T pi = 4;</code></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3472">N3472</a></td>
          <td>Binary integer literals</td>
          <td><code>int pi = 0b101001100;</code></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3781">N3781</a></td>
          <td>Digit separators</td>
          <td><code>int pi = 1'010'011'000;</code></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3760">N3760</a></td>
          <td><code>[[deprecated]]</code> attribute</td>
          <td>An attribute to mark deprecated names and entities.</td>
        </tr>

        <tr class="midsep">
          <td><a href="https://wg21.link/n3656">N3656</a></td>
          <td>Creation function <code>make_unique</code></td>
          <td><code>std::unique_ptr&lt;Base&gt; p = std::make_unique&lt;Derived&gt;(arg1, arg2, arg3);</code></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3668">N3668</a></td>
          <td>Algorithm <code>exchange</code></td>
          <td><code>T exchange(T&amp; x, U&amp;&amp; val) { T tmp = std::move(x); x = std::forward&lt;U&gt;(val); return tmp; }</code></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3657">N3657</a></td>
          <td>Heterogeneous lookup for associative containers</td>
          <td>The concept of a &ldquo;transparent comparator&rdquo; is introduced, which, if used,
            adds function <em>template</em> overloads <code>find</code>/<code>erase</code> etc.
            to associative containers. Convenience predicates <code>less&lt;&gt;</code> etc. are provided.</td>
        </tr>

        <tr>
          <td>
            <a href="https://wg21.link/n3659">N3659</a>,<br>
            <a href="https://wg21.link/n3891">N3891</a>,<br>
            <a href="https://wg21.link/lwg2288">LWG 2288</a>
          </td>
          <td>A shared mutex</td>
          <td>Reader/writer locking provided by class <code>shared_timed_mutex</code> and guard class <code>shared_lock</code>.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3658">N3658</a></td>
          <td>Compile-time integer sequences</td>
          <td><code>integer_sequence</code>, <code>index_sequence</code>, <code>make_index_sequence</code> etc., to allow tag dispatch on integer packs.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3654">N3654</a></td>
          <td>Quoted strings</td>
          <td><code>std::cout &lt;&lt; std::quoted(s);</code></td>
        </tr>

        <tr>
          <td>
            <a href="https://wg21.link/n3642">N3642</a>,<br>
            <a href="https://wg21.link/n3779">N3779</a>
          </td>
          <td>User-defined literals</td>
          <td>for strings and chrono<br>for complex</td>
        </tr>

      </tbody>
    </table>

    <h2 id="modified">Modifications and extensions of existing  features</h2>

    <table class="features">
      <thead>
        <tr><th>Document</th><th>Summary</th><th>Examples, notes</th></tr>
      </thead>
      <tbody>
        <tr>
          <td><a href="https://wg21.link/n3638">N3638</a></td>
          <td>Return type deduction for normal functions</td>
          <td><code>auto f() { return 10; }</code> declares <code>int f();</code>. In C++11, return type deduction was only available for lambda expressions.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/cwg975">CWG975</a></td>
          <td>Return type deduction for lambdas</td>
          <td>
            The return type of a lambda expression can be deduced even if there are multiple <code>return</code>
            statements. This makes lambda return type deduction work the same way as ordinary function return
            type deduction (see above). This is intended as a defect report against C++11.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3669">N3669</a></td>
          <td>Constexpr member functions without const</td>
          <td>A <code>constexpr</code> member function is no longer implicitly <code>const</code>. Only for
            <em>data</em> members does <code>constexpr</code> imply <code>const</code> now.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3652">N3652</a></td>
          <td>Relaxing constraints on constexpr functions</td>
          <td><code>constexpr</code> functions are far less restricted.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3653">N3653</a></td>
          <td>Member initializers and aggregates</td>
          <td>A class with default member initializers may now be an aggregate: <code>struct X { int a; int b = 10; }; X val = { 5 };</code></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/cwg974">CWG974</a></td>
          <td>Default arguments for lambdas</td>
          <td>
            Lambda expressions can now have default arguments: <code>auto f = [](int a = 10){}; f();</code>
            This is intended as a defect report against C++11.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3778">N3778</a></td>
          <td>Sized deallocation</td>
          <td>Deallocation functions may now be <code>void operator delete(void* ptr, size_t len)</code></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3664">N3664</a></td>
          <td>Mergeable allocation</td>
          <td>Adjacent dynamic allocations may now be fused into fewer, larger calls to <code>operator new</code>/<code>operator delete</code></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3624">N3624</a></td>
          <td>CWG1512: Pointer comparison vs qualification conversions</td>
          <td></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3667">N3667</a></td>
          <td>CWG1402: Deleted defaulted ctor</td>
          <td></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/cwg1288">CWG1288</a></td>
          <td>Direct-list-initialization of references</td>
          <td>
            References can now be initalized correctly using direct-list-initialization: <code>int &amp; r { n };</code>
            Previously, list-initialization would have called for a temporary. This is intended as a defect report against C++11.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3922">N3922</a><sup>DR</sup></td>
          <td>New rules for <code>auto</code> deduction from braced lists</td>
          <td>Previously, <code>auto a{1, 2, 3}, b{1};</code> was allowed and both
            variables were of type <code>initializer_list&lt;int&gt;</code>.
            Now <code>auto a{1, 2, 3};</code> is ill-formed and <code>auto b{1};</code>
            declares an <code>int</code>. Note that <code>auto a = {1, 2, 3}, b = {1};</code>
            remains unchanged and deduces <code>initializer_list&lt;int&gt;</code>.</td>
        </tr>

        <tr class="midsep">
          <td><a href="https://wg21.link/n3670">N3670</a></td>
          <td>Addressing tuples by type</td>
          <td><code>std::get&lt;int&gt;(my_tuple) = 10;</code> Ill-formed if the type is not unique.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3545">N3545</a></td>
          <td><code>integral_constant::operator()</code></td>
          <td>Given <code>integral_constant&lt;int, 123&gt; x;</code>, <code>x()</code> recovers the value <code>123</code>.</td>
        </tr>

        <tr>
          <td>
            <a href="https://wg21.link/n3302">N3302</a>,<br>
            <a href="https://wg21.link/n3470">N3470</a>,<br>
            <a href="https://wg21.link/n3469">N3469</a>,<br>
            <a href="https://wg21.link/n3471">N3471</a>,<br>
            <a href="https://wg21.link/n3789">N3789</a>
          </td>
          <td><code>constexpr</code> changes</td>
          <td>
            for <code>complex</code><br>
            for containers<br>
            for chrono<br>
            for utilities<br>
            for functional
          </td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3671">N3671</a></td>
          <td>4-iterator sequence operations</td>
          <td>Algorithms that operate on two ranges get new overloads that take being and end iterators
            for <em>both</em> ranges rather than requiring the second range to be sufficiently long.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3655">N3655</a></td>
          <td>Alias templates for traits</td>
          <td><code>template &lt;typename T&gt; using foo_t = foo&lt;T&gt;</code> for traits, e.g. <code>decay_t</code>. Part 4 of the paper is not applied.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3776">N3776</a></td>
          <td><code>future</code> destructor</td>
          <td>A clarification that the destructor of <code>future</code> does not normally block, except when it does.</td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3910">N3910</a></td>
          <td>CWG1441: signal handlers</td>
          <td>A clarification on atomic operations and synchronization in signal handlers.</td>
        </tr>

      </tbody>
    </table>

    <h2 id="misc">Miscellaneous</h2>

    <table class="features">
      <thead>
        <tr><th>Document</th><th>Summary</th><th>Examples, notes</th></tr>
      </thead>
      <tbody>

        <tr>
          <td><a href="https://wg21.link/n3786">N3786</a></td>
          <td>Prohibiting &ldquo;out of thin air&rdquo; results</td>
          <td></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3927">N3927</a></td>
          <td>Definition of lock-free</td>
          <td></td>
        </tr>

        <tr>
          <td><a href="https://wg21.link/n3323">N3323</a></td>
          <td>Contextual conversions</td>
          <td>A new notion of &ldquo;contextual convertibility&rdquo;</td>
        </tr>

      </tbody>
    </table>

    <h2 id="unlisted">Unlisted papers</h2>

    <p>The following minor papers are not listed above:
      <a href="https://wg21.link/n3346">N3346</a>,
      <a href="https://wg21.link/n3644">N3644</a>.

      The following papers contain accepted CWG issues:
      <a href="https://wg21.link/n3330">N3330</a>,
      <a href="https://wg21.link/n3382">N3382</a>,
      <a href="https://wg21.link/n3383">N3383</a>,
      <a href="https://wg21.link/n3539">N3539</a>,
      <a href="https://wg21.link/n3713">N3713</a>,
      <a href="https://wg21.link/n3833">N3833</a>,
      <a href="https://wg21.link/n3914">N3914</a>.

      The following papers contain accepted LWG issues:
      <a href="https://wg21.link/n3318">N3318</a>,
      <a href="https://wg21.link/n3438">N3438</a>,
      <a href="https://wg21.link/n3673">N3673</a>,
      <a href="https://wg21.link/n3522">N3522</a>,
      <a href="https://wg21.link/n3754">N3754</a>,
      <a href="https://wg21.link/n3788">N3788</a>,
      <a href="https://wg21.link/n3930">N3930</a>.</p>

  </body>
</html>
