<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3181: split_view::outer_iterator converting constructor is misconstrained</title>
<meta property="og:title" content="Issue 3181: split_view::outer_iterator converting constructor is misconstrained">
<meta property="og:description" content="C++ library issue. Status: NAD">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3181.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#NAD">NAD</a> status.</em></p>
<h3 id="3181"><a href="lwg-closed.html#3181">3181</a>. <code>split_view::outer_iterator</code> converting constructor is misconstrained</h3>
<p><b>Section:</b> 25.7.16.3 <a href="https://wg21.link/range.lazy.split.outer">[range.lazy.split.outer]</a> <b>Status:</b> <a href="lwg-active.html#NAD">NAD</a>
 <b>Submitter:</b> Casey Carter <b>Opened:</b> 2019-01-05 <b>Last modified:</b> 2023-02-07</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View other</b> <a href="lwg-index-open.html#range.lazy.split.outer">active issues</a> in [range.lazy.split.outer].</p>
<p><b>View all other</b> <a href="lwg-index.html#range.lazy.split.outer">issues</a> in [range.lazy.split.outer].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#NAD">NAD</a> status.</p>
<p><b>Discussion:</b></p>
<p>
The constraints on <code>split_view::outer_iterator</code>'s converting constructor:
<blockquote>
<pre>
constexpr outer_iterator(outer_iterator&lt;!Const&gt; i)
  requires Const &amp;&amp; ConvertibleTo&lt;iterator_t&lt;V&gt;, iterator_t&lt;const V&gt;&gt;;
</pre>
</blockquote>
are problematic. Since <code>const V</code> doesn't depend on a template parameter
of <code>outer_iterator</code>, compilers want to expand
<code>iterator_t&lt;const V&gt;</code> when <code>outer_iterator</code> is instantiated
- regardless of the value of <code>Const</code> - which can result in a hard error
when <code>iterator_t&lt;const V&gt;</code> is ill-formed. The constraint should
instead use <code>iterator_t&lt;Base&gt;</code>, as do the similar converting
constructors for the other range adaptor iterator and sentinel types.
</p>

<p><i>[2019-01-20 Reflector prioritization]</i></p>

<p>Set status to NAD</p>


<p id="res-3181"><b>Proposed resolution:</b></p>
<p>This wording is relative to <a href="https://wg21.link/n4791">N4791</a>.</p>

<ol>
<li><p>Change  [range.split.outer] as follows:</p>
<blockquote>
<pre>
namespace std::ranges {
  template&lt;class V, class Pattern&gt;
  template&lt;bool Const&gt;
  struct split_view&lt;V, Pattern&gt;::outer_iterator {
    [&hellip;]
    constexpr outer_iterator(outer_iterator&lt;!Const&gt; i)
      requires Const &amp;&amp; ConvertibleTo&lt;iterator_t&lt;V&gt;, iterator_t&lt;<del>const V</del><ins>Base</ins>&gt;&gt;;
    [&hellip;]
  };
}
</pre>
<p>
[&hellip;]
</p>
<pre>
constexpr outer_iterator(outer_iterator&lt;!Const&gt; i)
  requires Const &amp;&amp; ConvertibleTo&lt;iterator_t&lt;V&gt;, iterator_t&lt;<del>const V</del><ins>Base</ins>&gt;&gt;;
</pre>
<p>
-4- <i>Effects:</i> Initializes <code>parent_</code> with <code>i.parent_</code> and
<code>current_</code> with <code>std::move(i.current_)</code>.
</p><p>
[&hellip;]
</p>
</blockquote>
</li>
</ol>




</body>
</html>
