<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 892: Forward_list issues...</title>
<meta property="og:title" content="Issue 892: Forward_list issues...">
<meta property="og:description" content="C++ library issue. Status: NAD Editorial">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue892.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_Editorial">NAD Editorial</a> status.</em></p>
<h3 id="892"><a href="lwg-closed.html#892">892</a>. Forward_list issues...</h3>
<p><b>Section:</b> 23.3.7.6 <a href="https://wg21.link/forward.list.ops">[forward.list.ops]</a> <b>Status:</b> <a href="lwg-active.html#NAD_Editorial">NAD Editorial</a>
 <b>Submitter:</b> Ed Smith-Rowland <b>Opened:</b> 2008-09-15 <b>Last modified:</b> 2023-02-07</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all other</b> <a href="lwg-index.html#forward.list.ops">issues</a> in [forward.list.ops].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#NAD Editorial">NAD Editorial</a> status.</p>
<p><b>Discussion:</b></p>
<p>
I was looking at the latest draft on <code>forward_list</code>.  Especially the splice methods.
</p>
<p>
The first one splices a whole list after a given iterator in <code>this</code>.  The name is <code>splice_after</code>.
I think in  [forwardlist.ops] paragraph 40
change:
</p>
<blockquote><p>
<i>Effect:</i> Insert the contents of <code>x</code> <del>before</del> <ins>after</ins> <code>position</code>, ...
</p></blockquote>

<p>
A deeper issue involves the complexity.  <code>forward_list</code> has no <code>size</code> and we
don't know when we've reached the end except to walk up to it.  To
splice we would need to hook the end of the source list to the item
after <code>position</code> in this list.  This would involve walking length of the
source list until we got to the last dereference-able element in source.
There's no way we could do this in O(1) unless we stored a bogus end in
<code>forward_list</code>.
</p>
<p>
OTOH, the last version of <code>splice_after</code> with iterator ranges we could do
in O(1) because we know how to hook the end of the source range to ...
</p>
<p>
Unless I'm misconceiving the whole thing.  Which is possible.  I'll look at it again.
</p>
<p>
I'm pretty sure about the first part though.
</p>

<p><i>[
San Francisco:
]</i></p>


<blockquote>
<p>
This issue is more complicated than it looks.
</p>
<p>
paragraph 47: replace each <code>(first, last) with (first, last]</code>
</p>
<p>
add a statement after paragraph 48 that complexity is O(1)
</p>
<p>
remove the complexity statement from the first overload of splice_after
</p>
<p>
We may have the same problems with other modifiers, like erase_after.
Should it require that all iterators in the range (position, last] be
dereferenceable?
</p>
<p>
We do, however, like the proposed changes and consider them Editorial.
Move to NAD Editorial, Pending. Howard to open a new issue to handle the
problems with the complexity requirements.
</p>
<p>
Opened <a href="lwg-defects.html#897" title="Forward_list issues... Part 2 (Status: Resolved)">897</a><sup><a href="https://cplusplus.github.io/LWG/issue897" title="Latest snapshot">(i)</a></sup>.
</p>
</blockquote>


<p id="res-892"><b>Proposed resolution:</b></p>
<p>
In  [forwardlist.ops] paragraph 40
change:
</p>
<blockquote><p>
<i>Effect:</i> Insert the contents of <code>x</code> <del>before</del> <ins>after</ins> <code>position</code>, ...
</p></blockquote>





</body>
</html>
