<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3814: Add freestanding items requested by NB comments</title>
<meta property="og:title" content="Issue 3814: Add freestanding items requested by NB comments">
<meta property="og:description" content="C++ library issue. Status: C++23">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3814.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#C++23">C++23</a> status.</em></p>
<h3 id="3814"><a href="lwg-defects.html#3814">3814</a>. Add freestanding items requested by NB comments</h3>
<p><b>Section:</b> 20.2.2 <a href="https://wg21.link/memory.syn">[memory.syn]</a>, 25.2 <a href="https://wg21.link/ranges.syn">[ranges.syn]</a>, 32.5.2 <a href="https://wg21.link/atomics.syn">[atomics.syn]</a> <b>Status:</b> <a href="lwg-active.html#C++23">C++23</a>
 <b>Submitter:</b> Ben Craig <b>Opened:</b> 2022-11-06 <b>Last modified:</b> 2023-11-22</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all other</b> <a href="lwg-index.html#memory.syn">issues</a> in [memory.syn].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++23">C++23</a> status.</p>
<p><b>Discussion:</b></p>
<p>
This addresses the following NB comments:
</p>
<ul>
<li><p><b><a href="https://github.com/cplusplus/nbballot/issues/440">GB-085</a></b> (20.2.2 <a href="https://wg21.link/memory.syn">[memory.syn]</a> <code>start_lifetime_as</code> and <code>start_lifetime_as_array</code> should be freestanding)</p></li>
<li><p><b><a href="https://github.com/cplusplus/nbballot/issues/439">GB-110</a></b> (25.2 <a href="https://wg21.link/ranges.syn">[ranges.syn]</a> New views should be freestanding (<code>repeat</code>, <code>stride</code>, <code>cartesian_product</code>))</p></li>
<li><p>(partial) <b><a href="https://github.com/cplusplus/nbballot/issues/442">GB-130</a></b> (32.5.2 <a href="https://wg21.link/atomics.syn">[atomics.syn]</a> <code>memory_order_acquire</code> etc should be freestanding)</p></li>
</ul>
<p>
The explicit lifetime management functions requested by GB-085 have not been reviewed by LEWG in the context of freestanding, 
but they seem non-controversial in that context. None of the requested lifetime management functions run any code.  
I believe these were missed in post-merge conflict searches because the papers weren't targeted to LEWG or LWG at the time
of those searches.
<p/>
The ranges facilities requested by GB-110 <em>have</em> been reviewed on the LEWG mailing list in the context of freestanding.  
<a href="https://wg21.link/P1642R11" title=" Freestanding Library: Easy [utilities], [ranges], and [iterators]">P1642R11</a> mentions the <code>repeat</code>, <code>stride</code>, and <code>cartesian_product</code> papers in "Potential Post-LEWG 
merge conflicts". All were discussed in an April 2022 reflector discussion and received six votes in favor of allowing these papers 
into freestanding, with no opposition.
<p/>
The atomics facilities requested by GB-130 are essentially new names for existing facilities. Marking these as freestanding isn't 
concerning. There are concerns in GB-130 dealing with the specification details of freestanding enums, but those concerns won't be 
addressed in this issue.
</p>

<p><i>[Kona 2022-11-07; Move to Immediate]</i></p>


<p><i>[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Immediate &rarr; WP.]</i></p>



<p id="res-3814"><b>Proposed resolution:</b></p>
<p>
This wording is relative to <a href="https://wg21.link/N4917" title=" Working Draft, Standard for Programming Language C++">N4917</a>.
</p>

<ol>
<li><p>Modify 20.2.2 <a href="https://wg21.link/memory.syn">[memory.syn]</a>, header <code>&lt;memory&gt;</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
<i>// 20.2.6 <a href="https://wg21.link/obj.lifetime">[obj.lifetime]</a>, explicit lifetime management</i>
template&lt;class T&gt;
  T* start_lifetime_as(void* p) noexcept; <ins>// <i>freestanding</i></ins>
template&lt;class T&gt;
  const T* start_lifetime_as(const void* p) noexcept; <ins>// <i>freestanding</i></ins>
template&lt;class T&gt;
  volatile T* start_lifetime_as(volatile void* p) noexcept; <ins>// <i>freestanding</i></ins>
template&lt;class T&gt;
  const volatile T* start_lifetime_as(const volatile void* p) noexcept; <ins>// <i>freestanding</i></ins>
template&lt;class T&gt;
  T* start_lifetime_as_array(void* p, size_t n) noexcept; <ins>// <i>freestanding</i></ins>
template&lt;class T&gt;
  const T* start_lifetime_as_array(const void* p, size_t n) noexcept; <ins>// <i>freestanding</i></ins>
template&lt;class T&gt;
  volatile T* start_lifetime_as_array(volatile void* p, size_t n) noexcept; <ins>// <i>freestanding</i></ins>
template&lt;class T&gt;
  const volatile T* start_lifetime_as_array(const volatile void* p, size_t n) noexcept; <ins>// <i>freestanding</i></ins>
[&hellip;]
</pre>
</blockquote>

</li>

<li><p>Modify 25.2 <a href="https://wg21.link/ranges.syn">[ranges.syn]</a>, header <code>&lt;ranges&gt;</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
// <i>25.6.5 <a href="https://wg21.link/range.repeat">[range.repeat]</a>, repeat view</i>
template&lt;move_constructible W, semiregular Bound = unreachable_sentinel_t&gt;
  requires (is_object_v&lt;W&gt; &amp;&amp; same_as&lt;W, remove_cv_t&lt;W&gt;&gt;
    &amp;&amp; (<i>is-integer-like</i>&lt;Bound&gt; || same_as&lt;Bound, unreachable_sentinel_t&gt;))
class repeat_view; <ins>// <i>freestanding</i></ins>

namespace views { inline constexpr <i>unspecified</i> repeat = <i>unspecified</i>; } <ins>// <i>freestanding</i></ins>
[&hellip;]
// <i>25.7.32 <a href="https://wg21.link/range.stride">[range.stride]</a>, stride view</i>
template&lt;input_range V&gt;
  requires view&lt;V&gt;
class stride_view; <ins>// <i>freestanding</i></ins>

template&lt;class V&gt;
  inline constexpr bool enable_borrowed_range&lt;stride_view&lt;V&gt;&gt; = enable_borrowed_range&lt;V&gt;; <ins>// <i>freestanding</i></ins>

namespace views { inline constexpr <i>unspecified</i> stride = <i>unspecified</i>; } <ins>// <i>freestanding</i></ins>

// <i>25.7.33 <a href="https://wg21.link/range.cartesian">[range.cartesian]</a>, cartesian product view</i>
template&lt;input_range First, forward_range... Vs&gt;
  requires (view&lt;First&gt; &amp;&amp; ... &amp;&amp; view&lt;Vs&gt;)
class cartesian_product_view; <ins>// <i>freestanding</i></ins>

namespace views { inline constexpr <i>unspecified</i> cartesian_product = <i>unspecified</i>; } <ins>// <i>freestanding</i></ins>
[&hellip;]
</pre>
</blockquote>

</li>

<li><p>Modify 32.5.2 <a href="https://wg21.link/atomics.syn">[atomics.syn]</a>, header <code>&lt;atomic&gt;</code> synopsis, as indicated:</p>

<blockquote>
<pre>
namespace std {
  // <i>32.5.4 <a href="https://wg21.link/atomics.order">[atomics.order]</a>, order and consistency</i>
  enum class memory_order : <i>unspecified</i>; // <i>freestanding</i>
  inline constexpr memory_order memory_order_relaxed = memory_order::relaxed; <ins>// <i>freestanding</i></ins>
  inline constexpr memory_order memory_order_consume = memory_order::consume; <ins>// <i>freestanding</i></ins>
  inline constexpr memory_order memory_order_acquire = memory_order::acquire; <ins>// <i>freestanding</i></ins>
  inline constexpr memory_order memory_order_release = memory_order::release; <ins>// <i>freestanding</i></ins>
  inline constexpr memory_order memory_order_acq_rel = memory_order::acq_rel; <ins>// <i>freestanding</i></ins>
  inline constexpr memory_order memory_order_seq_cst = memory_order::seq_cst; <ins>// <i>freestanding</i></ins>
  [&hellip;]
}
</pre>
</blockquote>

</li>

</ol>





</body>
</html>
