This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

### 3165. All `starts_with()` overloads should be called "`begins_with`"

Section: 21.3.3 [basic.string], 21.4.3 [string.view.template] Status: NAD Submitter: Gennaro Prota Opened: 2018-10-22 Last modified: 2020-08-21

Priority: 2

View other active issues in [basic.string].

View all other issues in [basic.string].

View all issues with NAD status.

Discussion:

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 `std::basic_string::starts_with` and `std::basic_string_view::starts_with` are named inconsistently. These calls were added in P0457R2, 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.

[2018-11: Referred to LEWG after reflector discussion.]

[2020-05-28; LEWG issue reviewing]

LEWG issue processing voted to reject 3165 as NAD. Status change to Open.

>     Reject LWG3165 as NAD

>     SF F N A SA
>     21 1 0 1  0

[2020-08-21; Issue processing telecon: moved to NAD based on LEWG recommendation]

Proposed resolution:

This wording is relative to N4778.

1. Change 21.3.3 [basic.string], class template `basic_string` synopsis, as indicated:

   >     bool beginstarts_with(basic_string_view<charT, traits> x) const noexcept;
   >     bool beginstarts_with(charT x) const noexcept;
   >     bool beginstarts_with(const charT* x) const;

2. Change 21.3.3.8.5 [string.starts.with] as indicated

   >     bool beginstarts_with(basic_string_view<charT, traits> x) const noexcept;
   >     bool beginstarts_with(charT x) const noexcept;
   >     bool beginstarts_with(const charT* x) const;

   > > -1- Effects: Equivalent to:

   > >     return basic_string_view<charT, traits>(data(), size()).beginstarts_with(x);

3. Change 21.4.3 [string.view.template], class template `basic_string_view` synopsis, as indicated:

   >     constexpr bool beginstarts_with(basic_string_view x) const noexcept;
   >     constexpr bool beginstarts_with(charT x) const noexcept;
   >     constexpr bool beginstarts_with(const charT* x) const;

4. Change 21.4.3.7 [string.view.ops] as indicated:

   >     constexpr bool beginstarts_with(basic_string_view x) const noexcept;

   > > -20- Effects: Equivalent to: `return compare(0, npos, x) == 0;`

   >     constexpr bool beginstarts_with(charT x) const noexcept;

   > > -21- Effects: Equivalent to: `return beginstarts_with(basic_string_view(&x, 1));`

   >     constexpr bool beginstarts_with(const charT* x) const;

   > > -22- Effects: Equivalent to: `return beginstarts_with(basic_string_view(x));`