C++ Logo


Advanced search

Re: String contains member function

From: Paul Fee <paul.f.fee_at_[hidden]>
Date: Sun, 2 Jun 2019 17:08:35 +0100
On Mon, 27 May, 2019 at 1:30 PM Wim Leflere via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> Hello,
> After seeing that 'starts_with' and 'ends_with' were added to std::string
> in C++20 (P0457), I was wondering why 'contains' was still missing as a
> std::string member function.
> So I wrote a proposal (starting from P0457) to add it.
> Please find the draft of the proposal here:
> https://github.com/WimLeflere/cpp-papers/blob/master/string_contains_function.md
> I am looking forward to your valuable comments.
> Thanks,
> Wim Leflere

Hello Wim,

I like the idea of a contains method for substring checks. It aligns
with guidance from this page:

Which indicates that "The committee is particularly interested in
features that add usability for novices and occasional programmers".

I've also been crafting a proposal for a string::contains() member
function, on which I'd appreciate feedback. You can find it here:

It also references P0457 and hopefully covers some of the feedback
you've received via this mailing list thread. I hope to submit this
proposal. We could merge our work if you wish.


Received on 2019-06-02 11:10:33