<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 645: Missing members in match_results</title>
<meta property="og:title" content="Issue 645: Missing members in match_results">
<meta property="og:description" content="C++ library issue. Status: NAD Editorial">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue645.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="645"><a href="lwg-closed.html#645">645</a>. Missing members in match_results</h3>
<p><b>Section:</b> 28.6.9 <a href="https://wg21.link/re.results">[re.results]</a> <b>Status:</b> <a href="lwg-active.html#NAD_Editorial">NAD Editorial</a>
 <b>Submitter:</b> Daniel Kr&uuml;gler <b>Opened:</b> 2007-02-26 <b>Last modified:</b> 2016-01-28</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all other</b> <a href="lwg-index.html#re.results">issues</a> in [re.results].</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>
According to the description given in 28.6.9 <a href="https://wg21.link/re.results">[re.results]</a>/2 the class template
match_results "shall satisfy the requirements of a Sequence, [..],
except that only operations defined for const-qualified Sequences
are supported".
Comparing the provided operations from 28.6.9 <a href="https://wg21.link/re.results">[re.results]</a>/3 with the
sequence/container tables 80 and 81 one recognizes the following
missing operations:
</p>

<p>
1) The members
</p>

<blockquote><pre>
const_iterator rbegin() const;
const_iterator rend() const;
</pre></blockquote>

<p>
should exists because 23.1/10 demands these for containers
(all sequences are containers) which support bidirectional
iterators. Aren't these supported by match_result? This is not
explicitely expressed, but it's somewhat implied by two arguments:
</p>
<p>
(a) Several typedefs delegate to
<code>iterator_traits&lt;BidirectionalIterator&gt;</code>.
</p>
<p>
(b) The existence of <code>const_reference operator[](size_type n) const</code>
implies even random-access iteration.
I also suggest, that <code>match_result</code> should explicitly mention,
which minimum iterator category is supported and if this does
not include random-access the existence of <code>operator[]</code> is
somewhat questionable.
</p>
<p>
2) The new "convenience" members
</p>
<blockquote><pre>
const_iterator cbegin() const;
const_iterator cend() const;
const_iterator crbegin() const;
const_iterator crend() const;
</pre></blockquote>
<p>
should be added according to tables 80/81.
</p>


<p id="res-645"><b>Proposed resolution:</b></p>
<p>
Add the following members to the <code>match_results</code> synopsis after <code>end()</code> in 28.6.9 <a href="https://wg21.link/re.results">[re.results]</a>
para 3:
</p>

<blockquote><pre>
const_iterator cbegin() const; 
const_iterator cend() const;
</pre></blockquote>

<p>
In section 28.6.9.5 <a href="https://wg21.link/re.results.acc">[re.results.acc]</a> change:
</p>

<blockquote>
<pre>
const_iterator begin() const;
<ins>const_iterator cbegin() const;</ins>
</pre>
<blockquote>
<p>
-7- <i>Returns:</i> A starting iterator that enumerates over all the sub-expressions stored in <code>*this</code>.
</p>
</blockquote>

<pre>
const_iterator end() const;
<ins>const_iterator cend() const;</ins>
</pre>
<blockquote>
<p>
-8- <i>Returns:</i> A terminating iterator that enumerates over all the sub-expressions stored in <code>*this</code>.
</p>
</blockquote>
</blockquote>



<p><i>[
Kona (2007): Voted to adopt proposed wording in
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2409.pdf">N2409</a>
except removing the entry in the table container requirements.  Moved to Review.
]</i></p>


<p><i>[
Bellevue:  Proposed wording now in the WP.
]</i></p>





</body>
</html>
