<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="Microsoft FrontPage 5.0" />
  <title>C++17 Fundamentals - </title>
  <style type="text/css">code{white-space: pre;}</style>
  <link href="data:text/css;charset=utf-8,body%0A%7B%0Afont%2Dfamily%3A%20arial%2C%20sans%2Dserif%3B%0Amax%2Dwidth%3A%206%2E85in%3B%0Amargin%3A%200px%20auto%3B%0Afont%2Dsize%3A%2085%25%3B%0A%7D%0Ains%20%7Bbackground%2Dcolor%3A%20%23CCFFCC%3B%20text%2Ddecoration%3A%20none%3B%7D%0Adel%20%7Bbackground%2Dcolor%3A%20%23FFCACA%3B%20text%2Ddecoration%3A%20none%3B%7D%0Apre%20%7Bbackground%2Dcolor%3A%20%23D7EEFF%3B%20font%2Dsize%3A%2095%25%3B%20font%2Dfamily%3A%20%22courier%20new%22%2C%20courier%2C%20serif%3B%7D%0Acode%20%7Bfont%2Dsize%3A%20110%25%3B%20font%2Dfamily%3A%20%22courier%20new%22%2C%20courier%2C%20serif%3B%7D%0Atable%20%7Bfont%2Dsize%3A%2090%25%3B%7D%0A%0A" rel="stylesheet" type="text/css" />
  <base href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4562.html" />
</head>
<body>
<table>
<tr>
  <td align="left">Doc. no.:</td>
  <td align="left">P0220R1</td>
</tr>
<tr>
  <td align="left">Date:</td>
  <td align="left">2016-03-03
<tr>
  <td align="left">Reply to:</td>
  <td align="left">Beman Dawes &lt;bdawes at acm dot org&gt;, Alisdair Meredith &lt;ameredith1@bloomberg.net&gt;
</tr>
<tr>
  <td align="left">Audience:</td>
  <td align="left">Library, Library Evolution</td>
</tr>
</table>
<h1>Adopt Library Fundamentals V1 TS Components for C++17 (R1)</h1>


<p>There are currently several proposals in flight to adopt portions of the 
Library Fundamentals Technical Specification for C++17.</p>


<p>The difficulty of such a piecemeal approach is twofold. It adds a lot of 
unnecessary overhead to process many proposals rather than a single proposal. It 
may cause useful but unexciting components to get dropped on the floor because 
no one notices or because no one is willing to go through the drudgery of 
writing yet another proposal and shepherding it through the committee.</p>


<p>This paper proposes that the components of TS
<cxx-project-number>19568, <i>C++ Extensions for Library Fundamentals</i>, 
listed below be adopted into the C++17 working paper. </cxx-project-number>
The list was initialized with all of the components from
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4562.html">
N4562, the Library Fundamentals DTS</a>, and the LWG/LEWG then struck any
components that should not be incorporated directly into C++17.  This most
recent working paper has identical content to the PDTS, but has a format with
HTML anchors that can be directly linked from this paper.</p>
<p>
As a follow-up edit, the update to several exisiting C++17 header synopses
is provided directly in this paper, to more clearly specify edits for just
the new components being incorporated.
</p>

<ul>
<li>3 <a href="#utilities">General 
utilities library</a>
<ul>
  <li>3.2 <a href="#tuple">Tuples</a>
  <ul>
    <li>3.2.2 <a href="#tuple.apply">Calling 
    a function with a tuple of arguments</a> </li>
  </ul>
  </li>
</ul>
</li>
<li>4 <a href="#func">Function 
objects</a>
<ul>
  <li>4.3 <a href="#func.searchers">Searchers</a>
  <ul>
    <li>4.3.1 <a href="#func.searchers.default">Class 
    template default_searcher</a>
    <ul>
      <li>4.3.1.1 <a href="#func.searchers.default.creation">default_searcher 
      creation functions</a> </li>
    </ul>
    </li>
    <li>4.3.2 <a href="#func.searchers.boyer_moore">Class 
    template boyer_moore_searcher</a>
    <ul>
      <li>4.3.2.1 <a href="#func.searchers.boyer_moore.creation">boyer_moore_searcher 
      creation functions</a> </li>
    </ul>
    </li>
    <li>4.3.3 <a href="#func.searchers.boyer_moore_horspool">Class 
    template boyer_moore_horspool_searcher</a>
    <ul>
      <li>4.3.3.1 <a href="#func.searchers.boyer_moore_horspool.creation">boyer_moore_horspool_searcher 
      creation functions</a> </li>
    </ul>
    </li>
  </ul>
  </li>
</ul>
</li>
<li>5 <a href="#optional">Optional 
objects</a>
<ul>
  <li>5.1 <a href="#optional.general">In 
  general</a> </li>
  <li>5.2 <a href="#optional.synop">Header 
  &lt;optional&gt; synopsis</a> </li>
  <li>5.3 <a href="#optional.object">optional 
  for object types</a>
  <ul>
    <li>5.3.1 <a href="#optional.object.ctor">Constructors</a>
    </li>
    <li>5.3.2 <a href="#optional.object.dtor">Destructor</a>
    </li>
    <li>5.3.3 <a href="#optional.object.assign">Assignment</a>
    </li>
    <li>5.3.4 <a href="#optional.object.swap">Swap</a>
    </li>
    <li>5.3.5 <a href="#optional.object.observe">Observers</a>
    </li>
  </ul>
  </li>
  <li>5.4 <a href="#optional.inplace">In-place 
  construction</a> </li>
  <li>5.5 <a href="#optional.nullopt">No-value 
  state indicator</a> </li>
  <li>5.6 <a href="#optional.bad_optional_access">Class 
  bad_optional_access</a> </li>
  <li>5.7 <a href="#optional.relops">Relational 
  operators</a> </li>
  <li>5.8 <a href="#optional.nullops">Comparison 
  with nullopt</a> </li>
  <li>5.9 <a href="#optional.comp_with_t">Comparison 
  with T</a> </li>
  <li>5.10 <a href="#optional.specalg">Specialized 
  algorithms</a> </li>
  <li>5.11 <a href="#optional.hash">Hash 
  support</a> </li>
</ul>
</li>
<li>6 <a href="#any">Class 
any</a>
<ul>
  <li>6.1 <a href="#any.synop">Header 
  &lt;any&gt; synopsis</a> </li>
  <li>6.2 <a href="#any.bad_any_cast">Class 
  bad_any_cast</a> </li>
  <li>6.3 <a href="#any.class">Class 
  any</a>
  <ul>
    <li>6.3.1 <a href="#any.cons">any 
    construct/destruct</a> </li>
    <li>6.3.2 <a href="#any.assign">any 
    assignments</a> </li>
    <li>6.3.3 <a href="#any.modifiers">any 
    modifiers</a> </li>
    <li>6.3.4 <a href="#any.observers">any 
    observers</a> </li>
  </ul>
  </li>
  <li>6.4 <a href="#any.nonmembers">Non-member 
  functions</a> </li>
</ul>
</li>
<li>7 <a href="#string.view">string_view</a>
<ul>
  <li>7.1 <a href="#string.view.synop">Header 
  &lt;string_view&gt; synopsis</a> </li>
  <li>7.2 <a href="#string.view.template">Class 
  template basic_string_view</a> </li>
  <li>7.3 <a href="#string.view.cons">basic_string_view 
  constructors and assignment operators</a> </li>
  <li>7.4 <a href="#string.view.iterators">basic_string_view 
  iterator support</a> </li>
  <li>7.5 <a href="#string.view.capacity">basic_string_view 
  capacity</a> </li>
  <li>7.6 <a href="#string.view.access">basic_string_view 
  element access</a> </li>
  <li>7.7 <a href="#string.view.modifiers">basic_string_view 
  modifiers</a> </li>
  <li>7.8 <a href="#string.view.ops">basic_string_view 
  string operations</a>
  <ul>
    <li>7.8.1 <a href="#string.view.find">Searching 
    basic_string_view</a> </li>
  </ul>
  </li>
  <li>7.9 <a href="#string.view.comparison">basic_string_view 
  non-member comparison functions</a> </li>
  <li>7.10 <a href="#string.view.io">Inserters 
  and extractors</a> </li>
  <li>7.11 <a href="#string.view.hash">Hash 
  support</a> </li>
</ul>
</li>
<li>8 <a href="#memory">Memory</a>
<ul>
  <li>8.2 <a href="#memory.smartptr">Shared-ownership 
  pointers</a>
  <ul>
    <li>8.2.1 <a href="#memory.smartptr.shared">Class 
    template shared_ptr</a>
    <ul>
      <li>8.2.1.1 <a href="#memory.smartptr.shared.const">shared_ptr 
      constructors</a> </li>
      <li>8.2.1.2 <a href="#memory.smartptr.shared.obs">shared_ptr 
      observers</a> </li>
      <li>8.2.1.3 <a href="#memory.smartptr.shared.cast">shared_ptr 
      casts</a> </li>
    </ul>
    </li>
    <li>8.2.2 <a href="#memory.smartptr.weak">Class 
    template weak_ptr</a>
    <ul>
      <li>8.2.2.1 <a href="#memory.smartptr.weak.const">weak_ptr 
      constructors</a> </li>
    </ul>
    </li>
  </ul>
  </li>
  <li>8.5 <a href="#memory.resource">Class 
  memory_resource</a>
  <ul>
    <li>8.5.1 <a href="#memory.resource.overview">Class 
    memory_resource overview</a> </li>
    <li>8.5.2 <a href="#memory.resource.public">memory_resource 
    public member functions</a> </li>
    <li>8.5.3 <a href="#memory.resource.priv">memory_resource 
    protected virtual member functions</a> </li>
    <li>8.5.4 <a href="#memory.resource.eq">memory_resource 
    equality</a> </li>
  </ul>
  </li>
  <li>8.6 <a href="#memory.polymorphic.allocator.class">Class 
  template polymorphic_allocator</a>
  <ul>
    <li>8.6.1 <a href="#memory.polymorphic.allocator.overview">Class 
    template polymorphic_allocator overview</a> </li>
    <li>8.6.2 <a href="#memory.polymorphic.allocator.ctor">polymorphic_allocator 
    constructors</a> </li>
    <li>8.6.3 <a href="#memory.polymorphic.allocator.mem">polymorphic_allocator 
    member functions</a> </li>
    <li>8.6.4 <a href="#memory.polymorphic.allocator.eq">polymorphic_allocator 
    equality</a> </li>
  </ul>
  </li>
  <li>8.8 <a href="#memory.resource.global">Access 
  to program-wide memory_resource objects</a> </li>
  <li>8.9 <a href="#memory.resource.pool">Pool 
  resource classes</a>
  <ul>
    <li>8.9.1 <a href="#memory.resource.pool.overview">Classes 
    synchronized_pool_resource and unsynchronized_pool_resource</a> </li>
    <li>8.9.2 <a href="#memory.resource.pool.options">pool_options 
    data members</a> </li>
    <li>8.9.3 <a href="#memory.resource.pool.ctor">pool 
    resource constructors and destructors</a> </li>
    <li>8.9.4 <a href="#memory.resource.pool.mem">pool 
    resource members</a> </li>
  </ul>
  </li>
  <li>8.10 <a href="#memory.resource.monotonic.buffer">Class 
  monotonic_buffer_resource</a>
  <ul>
    <li>8.10.1 <a href="#memory.resource.monotonic.buffer.overview">Class 
    monotonic_buffer_resource overview</a> </li>
    <li>8.10.2 <a href="#memory.resource.monotonic.buffer.ctor">monotonic_buffer_resource 
    constructor and destructor</a> </li>
    <li>8.10.3 <a href="#memory.resource.monotonic.buffer.mem">monotonic_buffer_resource 
    members</a> </li>
  </ul>
  </li>
  <li>8.11 <a href="#memory.resource.aliases">Alias 
  templates using polymorphic memory resources</a>
  <ul>
    <li>8.11.1 <a href="#header.string.synop">Header 
    &lt;string&gt; synopsis</a> </li>
    <li>8.11.2 <a href="#header.deque.synop">Header 
    &lt;deque&gt; synopsis</a> </li>
    <li>8.11.3 <a href="#header.forward_list.synop">Header 
    &lt;forward_list&gt; synopsis</a> </li>
    <li>8.11.4 <a href="#header.list.synop">Header 
    &lt;list&gt; synopsis</a> </li>
    <li>8.11.5 <a href="#header.vector.synop">Header 
    &lt;vector&gt; synopsis</a> </li>
    <li>8.11.6 <a href="#header.map.synop">Header 
    &lt;map&gt; synopsis</a> </li>
    <li>8.11.7 <a href="#header.set.synop">Header 
    &lt;set&gt; synopsis</a> </li>
    <li>8.11.8 <a href="#header.unordered_map.synop">Header 
    &lt;unordered_map&gt; synopsis</a> </li>
    <li>8.11.9 <a href="#header.unordered_set.synop">Header 
    &lt;unordered_set&gt; synopsis</a> </li>
    <li>8.11.10 <a href="#header.regex.synop">Header 
    &lt;regex&gt; synopsis</a> </li>
  </ul>
  </li>
</ul>
</li>
<li>12 <a href="#algorithms">Algorithms 
library</a>
<ul>
  <li>12.1 <a href="#header.algorithm.synop">Header 
  &lt;algorithm&gt; synopsis</a> </li>
  <li>12.2 <a href="#alg.search">Search</a>
  </li>
  <li>12.3 <a href="#alg.random.sample">Sampling</a> </li>
</ul>
</li>
</ul>
<section>
<h2 id="directions">Directions to the C++ working paper project editor</h2>
<p>Add the components in the above list to the <cite>C++ working paper</cite> 
using the content for each component from
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4562.html">
N4562, the Library Fundamentals DTS</a>. Move this content from the
<code>std::experimental::fundamentals_v2</code> inline namespace to the <code>std</code> 
namespace. Strike <code>experimental/</code> from the header names, and any
additional <tt>#include</tt> directives in those header synopses.</p>
<p>Note: Although we are adopting only the specified Library Fundamentals V1 
components into the C++ working paper, the wording from those components comes 
from Library Fundamentals V2 to ensure the wording includes the latest 
corrections.</p>
</section>


<p>
<i>In addition, make the following changed to the header synposis clauses for
the following standard headers, with wording changes relative to
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4567.pdf">
N4567</a>, the current C++17 working draft.</i>
</p>

<h3>17.6.1.2 Headers [headers]</h3>
<p>
<i>Add the following new headers to Table 14:</i>
</p>
<ul>
<li><ins><tt>&lt;any&gt;</tt></ins></li>
<li><ins><tt>&lt;memory_resource&gt;</tt></ins></li>
<li><ins><tt>&lt;optional&gt;</tt></ins></li>
<li><ins><tt>&lt;string_view&gt;</tt></ins></li>
</ul>

<h2>20.4 Tuples [tuple]</h2>
<h3>20.4.1 In general [tuple.general]</h3>
<p>2 <b>Header &lt;tuple&gt; synopsis</b></p>
<pre>
namespace std {
  <i>// 20.4.2.9, specialized algorithms:</i>
  template &lt;class... Types&gt;
  void swap(tuple&lt;Types...&gt;&amp; x, tuple&lt;Types...&gt;&amp; y) noexcept(<i>see below</i>);
  <ins><i>// 20.4.2.X, Calling a function with a tuple of arguments</i></ins>
  <ins>template &lt;class F, class Tuple&gt;</ins>
  <ins>constexpr decltype(auto) apply(F&amp;&amp; f, Tuple&amp;&amp; t);</ins>
}
</pre>
<h2>20.9 Function objects [function.objects]</h2>
<p>2 <b>Header <functional> synopsis</b></p>
<pre>
namespace std {
  <ins><i>// 20.9.x, Searchers</i></ins>
  <ins>template&lt;class ForwardIterator, class BinaryPredicate = equal_to&lt;&gt;&gt;</ins>
    <ins>class default_searcher;</ins>
  <ins>template&lt;class RandomAccessIterator,</ins>
      <ins>class Hash = hash&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;,</ins>
      <ins>class BinaryPredicate = equal_to&lt;&gt;&gt;</ins>
    <ins>class boyer_moore_searcher;</ins>
  <ins>template&lt;class RandomAccessIterator,</ins>
      <ins>class Hash = hash&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;,</ins>
      <ins>class BinaryPredicate = equal_to&lt;&gt;&gt;</ins>
    <ins>class boyer_moore_horspool_searcher;</ins>

  <ins>template&lt;class ForwardIterator, class BinaryPredicate = equal_to&lt;&gt;&gt;</ins>
  <ins>default_searcher&lt;ForwardIterator, BinaryPredicate&gt;</ins>
  <ins>make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,</ins>
                        <ins>BinaryPredicate pred = BinaryPredicate());</ins>
  <ins>template&lt;class RandomAccessIterator,</ins>
     <ins>class Hash = hash&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;,</ins>
     <ins>class BinaryPredicate = equal_to&lt;&gt;&gt;</ins>
  <ins>boyer_moore_searcher&lt;RandomAccessIterator, Hash, BinaryPredicate&gt;</ins>
  <ins>make_boyer_moore_searcher(</ins>
      <ins>RandomAccessIterator pat_first, RandomAccessIterator pat_last,</ins>
      <ins>Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());</ins>
  <ins>template&lt;class RandomAccessIterator,</ins>
     <ins>class Hash = hash&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;,</ins>
     <ins>class BinaryPredicate = equal_to&lt;&gt;&gt;</ins>
  <ins>boyer_moore_horspool_searcher&lt;RandomAccessIterator, Hash, BinaryPredicate&gt;</ins>
  <ins>make_boyer_moore_horspool_searcher(</ins>
     <ins>RandomAccessIterator pat_first, RandomAccessIterator pat_last,</ins>
     <ins>Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());</ins>
}
</pre>

<p>
<i>Add the following new header synopsis, immediately preceding the additions for
<a href="#memory.resource">8.5 Class memory_resource</a></i>
</p>

<h2>20.9.x Polymorphic Memory Resources [memory.polymorphic.resource]</h2>
<h3>20.9.X.1 Header <tt>&lt;memory_resource&gt;</tt> synopsis [memory.resource.synop]</h3>
<pre>
namespace std::pmr {
  class memory_resource;
  bool operator==(const memory_resource&amp; a,
                  const memory_resource&amp; b) noexcept;
  bool operator!=(const memory_resource&amp; a,
                  const memory_resource&amp; b) noexcept;
  template &lt;class Tp&gt; class polymorphic_allocator;
  template &lt;class T1, class T2&gt;
  bool operator==(const polymorphic_allocator&lt;T1&gt;&amp; a,
                  const polymorphic_allocator&lt;T2&gt;&amp; b) noexcept;
  template &lt;class T1, class T2&gt;
  bool operator!=(const polymorphic_allocator&lt;T1&gt;&amp; a,
                  const polymorphic_allocator&lt;T2&gt;&amp; b) noexcept;
  <i>// Global memory resources</i>
  memory_resource* new_delete_resource() noexcept;
  memory_resource* null_memory_resource() noexcept;
  <i>// The default memory resource</i>
  memory_resource* set_default_resource(memory_resource* r) noexcept;
  memory_resource* get_default_resource() noexcept;
  <i>// Standard memory resources</i>
  struct pool_options;
  class synchronized_pool_resource;
  class unsynchronized_pool_resource;
  class monotonic_buffer_resource;
} </i>// namespace std::pmr</i></pre>

<hr>

</body>
</html>
