<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2454: Add raw_storage_iterator::base() member</title>
<meta property="og:title" content="Issue 2454: Add raw_storage_iterator::base() member">
<meta property="og:description" content="C++ library issue. Status: C++17">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2454.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++17">C++17</a> status.</em></p>
<h3 id="2454"><a href="lwg-defects.html#2454">2454</a>. Add <code>raw_storage_iterator::base()</code> member</h3>
<p><b>Section:</b> 99 [depr.storage.iterator] <b>Status:</b> <a href="lwg-active.html#C++17">C++17</a>
 <b>Submitter:</b> Jonathan Wakely <b>Opened:</b> 2014-11-11 <b>Last modified:</b> 2017-07-30</p>
<p><b>Priority: </b>0
</p>
<p><b>View all other</b> <a href="lwg-index.html#depr.storage.iterator">issues</a> in [depr.storage.iterator].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++17">C++17</a> status.</p>
<p><b>Discussion:</b></p>
<p>
Eric Niebler pointed out that <code>raw_storage_iterator</code> should give access
to the <code>OutputIterator</code> it wraps.
<p/>
This helps alleviate the exception-safety issue pointed out in the
discussion of LWG <a href="lwg-defects.html#2127" title="Move-construction with raw_storage_iterator (Status: C++17)">2127</a><sup><a href="https://cplusplus.github.io/LWG/issue2127" title="Latest snapshot">(i)</a></sup>, as an exception can be caught and then
destructors can be run for the constructed elements in the range
<code>[begin, raw.base())</code>
</p>

<p><i>[2015-02 Cologne]</i></p>

<p>
NJ: Is this "const" correct [in "base()"]? DK: Yes, we always do that. NJ: And the output iterator is not qualifying in any way? 
AM/DK: That wouldn't make sense. NJ: OK.
<p/>
VV: What did LEWG say about this feature request? In other words, why is this a library issue? AM: LEWG/JY thought this wouldn't 
be a contentious issue.
<p/>
NJ: I really hope the split of LEWG and LWG will be fixed soon, since it's only wasting time. VV: So you want to spend even 
more of your time on discussions that LEWG has?
<p/>
AM: I think this specified correctly. I'm not wild about it. But no longer bothered to stand in its way.
<p/>
GR: Why do we need to repeat the type in "Returns" even though it's part of the synopsis? AM: Good point, but not worth fixing.
<p/>
NJ: Why is "<code>base()</code>" for <code>reverse_iterator</code> commented with "// explicit"? AM: I guess in 1998 that was the 
only way to say this.
<p/>
AM: So, it's tentatively ready. 
</p>


<p id="res-2454"><b>Proposed resolution:</b></p>
<p>This wording is relative to <a href="http://www.open-std.org/jtc1/sc22/wg21/prot/14882fdis/n4140.pdf">N4140</a>.</p>

<ol>
<li><p>Add a new function to the synopsis in  [storage.iterator] p1:</p>

<blockquote><pre>
namespace std {
  template &lt;class OutputIterator, class T&gt;
  class raw_storage_iterator
    : public iterator&lt;output_iterator_tag,void,void,void,void&gt; {
  public:
    explicit raw_storage_iterator(OutputIterator x);

    raw_storage_iterator&lt;OutputIterator,T&gt;&amp; operator*();
    raw_storage_iterator&lt;OutputIterator,T&gt;&amp; operator=(const T&amp; element);
    raw_storage_iterator&lt;OutputIterator,T&gt;&amp; operator++();
    raw_storage_iterator&lt;OutputIterator,T&gt; operator++(int);
    <ins>OutputIterator base() const;</ins>
};
}
</pre></blockquote>
</li>

<li><p>Insert the new function and a new paragraph series after p7:</p>

<blockquote><pre>
<ins>OutputIterator base() const;</ins>
</pre><blockquote>
<p>
<ins>-?- <i>Returns</i>: An iterator of type <code>OutputIterator</code> that points to the
same value as <code>*this</code> points to.</ins>
</p>
</blockquote></blockquote>
</li>

</ol>





</body>
</html>
