<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3188: istreambuf_iterator::pointer should not be unspecified</title>
<meta property="og:title" content="Issue 3188: istreambuf_iterator::pointer should not be unspecified">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3188.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#New">New</a> status.</em></p>
<h3 id="3188"><a href="lwg-active.html#3188">3188</a>. <code>istreambuf_iterator::pointer</code> should not be <i>unspecified</i></h3>
<p><b>Section:</b> 24.6.4 <a href="https://wg21.link/istreambuf.iterator">[istreambuf.iterator]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Jonathan Wakely <b>Opened:</b> 2019-02-21 <b>Last modified:</b> 2019-10-30</p>
<p><b>Priority: </b>3
</p>
<p><b>View other</b> <a href="lwg-index-open.html#istreambuf.iterator">active issues</a> in [istreambuf.iterator].</p>
<p><b>View all other</b> <a href="lwg-index.html#istreambuf.iterator">issues</a> in [istreambuf.iterator].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
The current working paper requires <code>iterator_traits&lt;Iter&gt;::pointer</code> to be <code>void</code> if <code>Iter</code> 
doesn't define <code>operator-&gt;</code> (24.3.2.3 <a href="https://wg21.link/iterator.traits">[iterator.traits]</a>). We recently removed <code>operator-&gt;</code> 
from <code>istreambuf_iterator</code> via LWG <a href="lwg-defects.html#2790" title="Missing specification of istreambuf_iterator::operator-&gt; (Status: C++17)">2790</a><sup><a href="https://cplusplus.github.io/LWG/issue2790" title="Latest snapshot">(i)</a></sup>, therefore either its <code>pointer</code> member should be 
<code>void</code>, or there should be a partial specialization of <code>iterator_traits</code>. Do we want to change 
<i>unspecified</i> to <code>void</code> in the class synopsis in [istreambuf.iterator]?
</p>

<p><i>[2019-03-03, Daniel provides concrete wording]</i></p>


<p><i>[2019-03-05 Priority set to 3 after reflector discussion]</i></p>


<p><i>[2019-03-05, Daniel comments]</i></p>

<p>
With the acceptance of <a href="https://wg21.link/p1252r2">P1252R2</a> the committee decided to deprecate <code>operator-&gt;</code> 
of <code>move_iterator</code>, interestingly without mentioning what should happen with its current <code>pointer</code> typedef (which
is equal to the template parameter <code>Iterator</code> and thus never <code>void</code>). Effectively this is a very similar situation 
as for the here discussed <code>istreambuf_iterator</code> case and it seems attractive to me to solve both cases similarly. 
</p>

<p><i>[2019-10-30, Jonathan comments]</i></p>

<p>
Also, <code>reverse_iterator::operator-&gt;()</code> is now constrained and so not always defined, but 
<code>reverse_iterator::pointer</code> is defined unconditionally.
</p>


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

<ol>
<li><p>Change class template <code>istreambuf_iterator</code> synopsis, 24.6.4 <a href="https://wg21.link/istreambuf.iterator">[istreambuf.iterator]</a>, as indicated:</p>

<blockquote>
<pre>
template&lt;class charT, class traits = char_traits&lt;charT&gt;&gt;
class istreambuf_iterator {
public:
  using iterator_category = input_iterator_tag;
  using value_type        = charT;
  using difference_type   = typename traits::off_type;
  using pointer           = <ins>void</ins><del><i>unspecified</i></del>;
  using reference         = charT;
  [&hellip;]
};
</pre>
</blockquote>
</li>
</ol>




</body>
</html>
