Skip to content

[C++] C++20: use starts_with/ends_with methods #48592

Closed

Description

@pitrou

Describe the enhancement requested

std::string and std::string_view have gained starts_with and ends_with methods that can allow some code simplification (and we can also remove our StartsWith / EndsWith helper functions).

Component(s)

C++

Activity

  1. jonahkel commented on Dec 18, 2025

    @jonahkel
    Contributor

    Hi, I'd like to implement this enhancement as my first OSS contribution. Is there anything I should know before I begin?

  2. jonahkel commented on Dec 18, 2025

    @jonahkel
    Contributor

    take

  3. pitrou commented on Dec 19, 2025

    @pitrou
    MemberAuthor

    Yes, of course, feel free to submit a PR @jonahkel

  4. jonahkel commented on Dec 19, 2025

    @jonahkel
    Contributor

    Are all of the files that need to be changed in cpp/ ?
    Also, is it sufficient for me to run the cpp unit tests and style checks after I make my changes?

  5. jonahkel commented on Dec 19, 2025

    @jonahkel
    Contributor

    I made the changes but I'm having trouble testing them. When building using the cmake ninja-debug-basic preset I expect unit test files to be generated in build/debug. However, no tests are generated, so ctest is failing.

  6. pitrou commented on Dec 20, 2025

    @pitrou
    MemberAuthor

    Are all of the files that need to be changed in cpp/ ?

    I think so, but you can check by searching through the codebase.

    Also, is it sufficient for me to run the cpp unit tests and style checks after I make my changes?

    It should. More builds will be run once you open a PR.

  7. pitrou commented on Dec 20, 2025

    @pitrou
    MemberAuthor

    When building using the cmake ninja-debug-basic preset I expect unit test files to be generated in build/debug. However, no tests are generated, so ctest is failing.

    ctest should work, but you have to run it from the build directory (or you can pass the directory through a ctest option, I don't remember which one).

  8. Soumyadeep-4704 commented on Dec 21, 2025

    @Soumyadeep-4704

    I want to work on this and kickstart my journey in the open-source world. Can I work on this?

  9. jonahkel commented on Dec 21, 2025

    @jonahkel
    Contributor

    I've already made the necessary changes. There's just one failing test I need to address and then it will be done.

  10. added a commit that references this issue on Jan 5, 2026
  11. added this to the 23.0.0 milestone on Jan 5, 2026
  12. pitrou commented on Jan 5, 2026

    @pitrou
    MemberAuthor

    Issue resolved by pull request 48614
    #48614

  13. added a commit that references this issue on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions