220 32675 <525dfba6-3329-4c8f-94eb-9f90b39e9a49@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: std::string::find implementation
Date: Tue, 30 May 2017 16:29:52 -0700 (PDT)
Lines: 83
Approved: news@gmane.org
Message-ID: <525dfba6-3329-4c8f-94eb-9f90b39e9a49@isocpp.org>
References: <82be917c-b3c8-4cb4-bbbc-0f62ec78ce84@isocpp.org>
 <fe3c4197-9cd6-3309-ee7a-1c6b99077081@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_3946_21777472.1496186992283"
X-Trace: blaine.gmane.org 1496187005 29518 195.159.176.226 (30 May 2017 23:30:05 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 30 May 2017 23:30:05 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDLZJYWNDQIPBAFYZECRUBD4ASODK@isocpp.org Wed May 31 01:29:49 2017
Return-path: <std-proposals+bncBDLZJYWNDQIPBAFYZECRUBD4ASODK@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f197.google.com ([209.85.223.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDLZJYWNDQIPBAFYZECRUBD4ASODK@isocpp.org>)
	id 1dFqaC-00071p-It
	for gclcip-std-proposals@m.gmane.org; Wed, 31 May 2017 01:29:48 +0200
Original-Received: by mail-io0-f197.google.com with SMTP id d6sf2644160ioe.13
        for <gclcip-std-proposals@m.gmane.org>; Tue, 30 May 2017 16:29:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=Aly5RAVkYTqB4tTOZyTzqnRLka60HEUE44x3hmtCtps=;
        b=FE4JvY5bJix6rJ3htrOFP/5nKCZnpqHgToVb5ztU/8GcyVABpOsUtI1YtGVWA6lXez
         X2jvP5O8m6RdjCOpuxhdy8D3fzy3ygtiDdoHaMzC9E+LgyGNwfSJLuSmbLtTiFOOZp1+
         ENepxBOTxQObxzTI7GoZt5IHcEIDUcoHhWSxzuFMoVUzc1NYLPaoxVypmdVdkxHlJ1iJ
         tLwMzMDzKDM4UgBbjxgofDj6aQBq6ZBy+76TC64RY+6j7G37BFaNTDadpQf40XHHbHN6
         GI8gIywcccyoHcbiaU3yc3lQZa8Qfb9U0KrLAVEeDx6+bMkuW4fm9xQ4QHxUVemT4tVK
         WSsQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=Aly5RAVkYTqB4tTOZyTzqnRLka60HEUE44x3hmtCtps=;
        b=ggKrFEP7z2GWW9oPj0SlbJAaGVvcmHzoDCT1bL1QoCOX5F8eMmJgvV6FKVO+goIUw3
         +1AIVFQQ9i9+NeQ72dAXjTMtKMu7bAbWyEH6mkCNFVEOzZd3/KsDnzYVTsyc/rt9hFwq
         1dUW0ildJ4UwV2DJQxhWbdkqiqGhuCcxcJoH5LepxbUDmbCPhxQPr1jQCSdyfVrkGmFA
         Wb7/Ym+A0SLIdTo2h9nM0yTcVlRRnpcQod5lk4QUXGb75E8CviE2VQohEP3+8IPrGpYz
         HGc1TjlUgMVn4DtOoYOP0r1n+CkNsPB500XGeCE3/5YJb+09k0wDV6WM8yfJzjbL4ezA
         qQeg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=Aly5RAVkYTqB4tTOZyTzqnRLka60HEUE44x3hmtCtps=;
        b=V3MGfLNs2KvlaTnYekWcxHqJW/sQWH/vlfMwfmQO1dDYbdaQDBDLtdvuSDZOPWGkQU
         eB9Nxg4gq+Utg7b6bmh9TkAaRkEWW25WzcL2EzdcRwf/qkJF8oXe6vojncBqzs0SaqQ5
         QWfMEx9VXlo4qLdXFkeddO6kj9K4HxIv45TH/BJnDNiclMSzUBz/pxvfOFhhOSw9uMzF
         TiGHG+hLBieWBWBQH/Y21vsERgzwezpo1M02dScWdqc7/Dk0WT35zTA+dC7NJjjjlIc4
         W4VA1B5tUwGCAS+vym2rBQboP8lYMs1xXn0xflfzaGtQuvCLwafPeujm2zWrqjJvx1aK
         VsXA==
X-Gm-Message-State: AODbwcBtj9QLFCO1U0uemqGGg1/LJgv75plXV1Kj2t4ksRtUtkW0vmSN
	RAKXkSijAIsN+Ph4
X-Received: by 10.107.47.159 with SMTP id v31mr4208391iov.45.1496186993659;
        Tue, 30 May 2017 16:29:53 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.11.36 with SMTP id a33ls1854899ota.35.gmail; Tue, 30 May
 2017 16:29:52 -0700 (PDT)
X-Received: by 10.157.35.104 with SMTP id k37mr498280otd.14.1496186992792;
        Tue, 30 May 2017 16:29:52 -0700 (PDT)
In-Reply-To: <fe3c4197-9cd6-3309-ee7a-1c6b99077081@gmail.com>
X-Original-Sender: arthur.j.odwyer@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:32675
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32675>

------=_Part_3946_21777472.1496186992283
Content-Type: multipart/alternative; 
	boundary="----=_Part_3947_1417624030.1496186992284"

------=_Part_3947_1417624030.1496186992284
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tuesday, May 30, 2017 at 6:38:03 AM UTC-7, Jonathan M=C3=BCller wrote:
>
> Now with `string_view` this could easily be achieved by taking a=20
> substring view and searching there. Problem is `std::string::substr()`=20
> doesn't actually return a view which makes it kind of awkward (have to=20
> create a view to the whole string, then substr).=20
>

That is, the OP's use-case is simply this:

    std::string mystring;

    // proposed extension:
    auto p1 =3D mystring.find('A', 10, 15);

    // actual C++17:
    auto p1 =3D std::string_view(mystring).substr(10, 5).find('A');

Looks to me like we don't need any more surface area to get what he wants.

=E2=80=93Arthur

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/525dfba6-3329-4c8f-94eb-9f90b39e9a49%40isocpp.or=
g.

------=_Part_3947_1417624030.1496186992284
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tuesday, May 30, 2017 at 6:38:03 AM UTC-7, Jonathan M=
=C3=BCller wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Now with `str=
ing_view` this could easily be achieved by taking a=20
<br>substring view and searching there. Problem is `std::string::substr()`=
=20
<br>doesn&#39;t actually return a view which makes it kind of awkward (have=
 to=20
<br>create a view to the whole string, then substr).
<br></blockquote><div><br></div><div>That is, the OP&#39;s use-case is simp=
ly this:</div><div><br></div><div>=C2=A0 =C2=A0 std::string mystring;</div>=
<div><br></div><div>=C2=A0 =C2=A0 // proposed extension:</div><div>=C2=A0 =
=C2=A0 auto p1 =3D mystring.find(&#39;A&#39;, 10, 15);<br></div><div><br></=
div><div>=C2=A0 =C2=A0 // actual C++17:</div><div>=C2=A0 =C2=A0 auto p1 =3D=
 std::string_view(mystring).substr(10, 5).find(&#39;A&#39;);<br></div><div>=
<div><br></div></div><div>Looks to me like we don&#39;t need any more surfa=
ce area to get what he wants.</div><div><br></div><div>=E2=80=93Arthur</div=
></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/525dfba6-3329-4c8f-94eb-9f90b39e9a49%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/525dfba6-3329-4c8f-94eb-9f90b39e9a49=
%40isocpp.org</a>.<br />

------=_Part_3947_1417624030.1496186992284--

------=_Part_3946_21777472.1496186992283--

.
