Title
All starts_with() overloads should be called "begins_with"
Status
nad
Section
[basic.string][string.view.template]
Submitter
Gennaro Prota

Created on 2018-10-22.00:00:00 last changed 52 months ago

Messages

Date: 2020-08-21.20:26:35

Proposed resolution:

This wording is relative to N4778.

  1. Change [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 [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 [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 [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));

Date: 2020-08-15.00:00:00

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

Date: 2020-05-15.00:00:00

[ 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
Date: 2020-05-31.09:54:47

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

Date: 2020-05-31.09:54:47

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.

History
Date User Action Args
2020-08-21 20:26:35adminsetmessages: + msg11451
2020-08-21 20:26:35adminsetstatus: open -> nad
2020-05-31 09:54:47adminsetmessages: + msg11316
2020-05-31 09:54:47adminsetmessages: + msg11315
2020-05-31 09:54:47adminsetstatus: lewg -> open
2018-11-27 04:34:19adminsetstatus: new -> lewg
2018-10-25 17:33:27adminsetmessages: + msg10168
2018-10-22 00:00:00admincreate