C++ Logo

std-proposals

Advanced search

Re: String contains member function

From: Tony V E <tvaneerd_at_[hidden]>
Date: Sun, 2 Jun 2019 13:45:07 -0400
On Sun, Jun 2, 2019 at 12:08 PM Paul Fee via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> 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:
>
> http://open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3370.html
> 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:
> https://github.com/pfee/cxx_proposal/blob/master/WG21_string_contains.pdf
>
> 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.
>
> Thanks,
> Paul
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>


-- 
Be seeing you,
Tony

Received on 2019-06-02 12:47:08