On Sun, Jun 2, 2019 at 12:08 PM Paul Fee via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On Mon, 27 May, 2019 at 1:30 PM Wim Leflere via Std-Proposals
<std-proposals@lists.isocpp.org> 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".

It doesn't align with "things that are hard to get right"
but it does align with "things that are very commonly written" - I've seen variants of contains() in many codebases.
(these are two criteria often used by LEWG)

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.

Std-Proposals mailing list

Be seeing you,