C++ Logo

std-proposals

Advanced search

Re: [std-proposals] .first() and .last() in strings

From: Bo Persson <bo_at_[hidden]>
Date: Tue, 30 Apr 2024 11:28:39 +0200
On 2024-04-30 at 09:16, Rhidian De Wit via Std-Proposals wrote:
> Hello everyone,
>
> I've finally had some time to write a small proposal for a small
> addition to std::string and std::string_view.
> I will later add the proposed wording, but I'd already be appreciative
> of whatever comments anyone might have.
>

The usual objection to extending std::string is of course that the
interface is already *way* too big. Why not remove some parts instead?
(looking at find_last_not_of) :-)

Objection 2 is that this is something that can already be done in the
existing language. Adding more ways to do the same thing is also nothing
that C++ desperately needs.

Looking at the names, it is not immediately obvious how .first() is
related to .find_first_of(). Can this not cause confusion, similar to
clear() vs empty()?

Received on 2024-04-30 09:28:50