<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3165: All starts_with() overloads should be called "begins_with"</title>
<meta property="og:title" content="Issue 3165: All starts_with() overloads should be called &quot;begins_with&quot;">
<meta property="og:description" content="C++ library issue. Status: NAD">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3165.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="3165"><a href="lwg-closed.html#3165">3165</a>. All <code>starts_with()</code> overloads should be called "<code>begins_with</code>"</h3>
<p><b>Section:</b> 27.4.3 <a href="https://wg21.link/basic.string">[basic.string]</a>, 27.3.3 <a href="https://wg21.link/string.view.template">[string.view.template]</a> <b>Status:</b> <a href="lwg-active.html#NAD">NAD</a>
 <b>Submitter:</b> Gennaro Prota <b>Opened:</b> 2018-10-22 <b>Last modified:</b> 2020-08-21</p>
<p><b>Priority: </b>2
</p>
<p><b>View other</b> <a href="lwg-index-open.html#basic.string">active issues</a> in [basic.string].</p>
<p><b>View all other</b> <a href="lwg-index.html#basic.string">issues</a> in [basic.string].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#NAD">NAD</a> status.</p>
<p><b>Discussion:</b></p>
<p>
Throughout the standard library, the opposite of the verb "to end" is "to begin", not to "to start". In this 
respect, all the overloads of <code>std::basic_string::starts_with</code> and <code>std::basic_string_view::starts_with</code> 
are named inconsistently. These calls were added in <a href="https://wg21.link/p0457r2">P0457R2</a>, which refers 
to analogous functions in Java, Python, Qt, LLVM, WebKit, all of which use the term "start". But, in our opinion, 
the C++ standard library should first be consistent with itself. 
</p>

<p><i>[2018-11: Referred to LEWG after reflector discussion.]</i></p>


<p><i>[2020-05-28; LEWG issue reviewing]</i></p>

<p>
LEWG issue processing voted to reject 3165 as NAD. Status change to Open.
</p>
<blockquote>
<pre>
Reject LWG3165 as NAD

SF F N A SA
21 1 0 1  0
</pre>
</blockquote>

<p><i>[2020-08-21; Issue processing telecon: moved to NAD based on LEWG recommendation]</i></p>



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

<ol>
<li><p>Change 27.4.3 <a href="https://wg21.link/basic.string">[basic.string]</a>, class template <code>basic_string</code> synopsis, as indicated:</p>
<blockquote>
<pre>
bool <ins>begin</ins><del>start</del>s_with(basic_string_view&lt;charT, traits&gt; x) const noexcept;
bool <ins>begin</ins><del>start</del>s_with(charT x) const noexcept;
bool <ins>begin</ins><del>start</del>s_with(const charT* x) const;
</pre>
</blockquote>
</li>

<li><p>Change 27.4.3.8.5 <a href="https://wg21.link/string.starts.with">[string.starts.with]</a> as indicated</p>
<blockquote>
<pre>
bool <ins>begin</ins><del>start</del>s_with(basic_string_view&lt;charT, traits&gt; x) const noexcept;
bool <ins>begin</ins><del>start</del>s_with(charT x) const noexcept;
bool <ins>begin</ins><del>start</del>s_with(const charT* x) const;
</pre>
<blockquote>
<p>
-1- <i>Effects:</i> Equivalent to:
</p>
<pre>
return basic_string_view&lt;charT, traits&gt;(data(), size()).<ins>begin</ins><del>start</del>s_with(x);
</pre>
</blockquote>
</blockquote>
</li>

<li><p>Change 27.3.3 <a href="https://wg21.link/string.view.template">[string.view.template]</a>, class template <code>basic_string_view</code> synopsis, as indicated:</p>
<blockquote>
<pre>
constexpr bool <ins>begin</ins><del>start</del>s_with(basic_string_view x) const noexcept;
constexpr bool <ins>begin</ins><del>start</del>s_with(charT x) const noexcept;
constexpr bool <ins>begin</ins><del>start</del>s_with(const charT* x) const;
</pre>
</blockquote>
</li>

<li><p>Change 27.3.3.8 <a href="https://wg21.link/string.view.ops">[string.view.ops]</a> as indicated:</p>
<blockquote>
<pre>
constexpr bool <ins>begin</ins><del>start</del>s_with(basic_string_view x) const noexcept;
</pre>
<blockquote>
<p>
-20- <i>Effects:</i> Equivalent to: <code>return compare(0, npos, x) == 0;</code>
</p>
</blockquote>
<pre>
constexpr bool <ins>begin</ins><del>start</del>s_with(charT x) const noexcept;
</pre>
<blockquote>
<p>
-21- <i>Effects:</i> Equivalent to: <code>return <ins>begin</ins><del>start</del>s_with(basic_string_view(&amp;x, 1));</code>
</p>
</blockquote>
<pre>
constexpr bool <ins>begin</ins><del>start</del>s_with(const charT* x) const;
</pre>
<blockquote>
<p>
-22- <i>Effects:</i> Equivalent to: <code>return <ins>begin</ins><del>start</del>s_with(basic_string_view(x));</code>
</p>
</blockquote>
</blockquote>
</li>
</ol>






</body>
</html>
