Topic: std::string_view::without_*, alternatives to the


Author: Justin Bassett <jbassett271@gmail.com>
Date: Wed, 27 Jun 2018 23:17:55 -0700 (PDT)
Raw View
------=_Part_1798_2008408428.1530166675045
Content-Type: multipart/alternative;
 boundary="----=_Part_1799_184356210.1530166675046"

------=_Part_1799_184356210.1530166675046
Content-Type: text/plain; charset="UTF-8"

I've found that I almost never want the remove_prefix or remove_suffix functions,
but would rather have without_* versions which return the value.

I want to be able to write:

std::string_view sv = "some text";
auto sv2 = sv.without_prefix(2);
assert(sv2 == "me text");

The function would look something like this:

std::string_view without_prefix(size_type n) const {
    std::string_view result = *this;
    result.remove_prefix(n);
    return result;
}

In some cases, it can make a bigger difference, especially when you mark
everything as const if possible. remove_prefix, remove_suffix, and swap are
the only modifiers for string_view, so having to mark it non-const just for
the remove_*s is annoying.

--
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 email 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/5af130c9-1394-4f6d-b80e-a08b2537f095%40isocpp.org.

------=_Part_1799_184356210.1530166675046
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I&#39;ve found that I almost never want the=C2=A0<fon=
t face=3D"courier new, monospace">remove_prefix</font>=C2=A0or=C2=A0<font f=
ace=3D"courier new, monospace">remove_suffix</font>=C2=A0functions, but wou=
ld rather have=C2=A0<font face=3D"courier new, monospace">without_*</font>=
=C2=A0versions which return the value.</div><div><br></div>I want to be abl=
e to write:<div><br></div><div><div class=3D"prettyprint" style=3D"backgrou=
nd-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-styl=
e: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyp=
rint"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">string_view sv </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;s=
ome text&quot;</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> sv2 </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> sv</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">without_prefix</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066;" cla=
ss=3D"styled-by-prettify">2</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span><font color=3D"#880000"><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">assert</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">sv2 </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">=3D=3D</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quo=
t;me text&quot;</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">);</span></font></div></code></div></div><div><br></div><div>The funct=
ion would look something like this:</div><div><br></div><div><div class=3D"=
prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: r=
gb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break=
-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">string_view without_prefix</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">size_type n</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">const</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">string_view result </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">this</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 result</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">remove_prefix</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">n</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">return</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> result</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">}</span></div></code></div><br></div><div>In some cases, =
it can make a bigger difference, especially when you mark everything as con=
st if possible. <font face=3D"courier new, monospace">remove_prefix,</font>=
=C2=A0<font face=3D"courier new, monospace">remove_suffix, </font><font fac=
e=3D"arial, sans-serif">and</font><font face=3D"courier new, monospace"> sw=
ap=C2=A0</font><font face=3D"arial, sans-serif">are the only modifiers for =
string_view, so having to mark it non-const just for the remove_*s is annoy=
ing.</font></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/5af130c9-1394-4f6d-b80e-a08b2537f095%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5af130c9-1394-4f6d-b80e-a08b2537f095=
%40isocpp.org</a>.<br />

------=_Part_1799_184356210.1530166675046--

------=_Part_1798_2008408428.1530166675045--

.


Author: Richard Hodges <hodges.r@gmail.com>
Date: Thu, 28 Jun 2018 08:27:55 +0200
Raw View
--00000000000094a9f6056fadd52a
Content-Type: text/plain; charset="UTF-8"

On Thu, 28 Jun 2018 at 08:17, Justin Bassett <jbassett271@gmail.com> wrote:

> I've found that I almost never want the remove_prefix or remove_suffix functions,
> but would rather have without_* versions which return the value.
>
> I want to be able to write:
>
> std::string_view sv = "some text";
> auto sv2 = sv.without_prefix(2);
> assert(sv2 == "me text");
>
>
This already exists:

std::string_view sv = "some text";
auto sv2 = sv.substr(2);
assert(sv2 == "me text");



> The function would look something like this:
>
> std::string_view without_prefix(size_type n) const {
>     std::string_view result = *this;
>     result.remove_prefix(n);
>     return result;
> }
>
> In some cases, it can make a bigger difference, especially when you mark
> everything as const if possible. remove_prefix, remove_suffix, and swap are
> the only modifiers for string_view, so having to mark it non-const just for
> the remove_*s is annoying.
>
> --
> 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
> email 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/5af130c9-1394-4f6d-b80e-a08b2537f095%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5af130c9-1394-4f6d-b80e-a08b2537f095%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

--
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 email 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/CALvx3hYgoi-0J105_jnvHf2bRBzxeA19szxroCar7e7UFU_Y3A%40mail.gmail.com.

--00000000000094a9f6056fadd52a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Thu=
, 28 Jun 2018 at 08:17, Justin Bassett &lt;<a href=3D"mailto:jbassett271@gm=
ail.com">jbassett271@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D=
"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding=
-left:1ex"><div dir=3D"ltr"><div>I&#39;ve found that I almost never want th=
e=C2=A0<font face=3D"courier new, monospace">remove_prefix</font>=C2=A0or=
=C2=A0<font face=3D"courier new, monospace">remove_suffix</font>=C2=A0funct=
ions, but would rather have=C2=A0<font face=3D"courier new, monospace">with=
out_*</font>=C2=A0versions which return the value.</div><div><br></div>I wa=
nt to be able to write:<div><br></div><div><div class=3D"m_3096222560286236=
931prettyprint" style=3D"background-color:rgb(250,250,250);border-color:rgb=
(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><co=
de class=3D"m_3096222560286236931prettyprint"><div class=3D"m_3096222560286=
236931subprettyprint"><span style=3D"color:#000" class=3D"m_309622256028623=
6931styled-by-prettify">std</span><span style=3D"color:#660" class=3D"m_309=
6222560286236931styled-by-prettify">::</span><span style=3D"color:#000" cla=
ss=3D"m_3096222560286236931styled-by-prettify">string_view sv </span><span =
style=3D"color:#660" class=3D"m_3096222560286236931styled-by-prettify">=3D<=
/span><span style=3D"color:#000" class=3D"m_3096222560286236931styled-by-pr=
ettify"> </span><span style=3D"color:#080" class=3D"m_3096222560286236931st=
yled-by-prettify">&quot;some text&quot;</span><span style=3D"color:#660" cl=
ass=3D"m_3096222560286236931styled-by-prettify">;</span><span style=3D"colo=
r:#000" class=3D"m_3096222560286236931styled-by-prettify"><br></span><span =
style=3D"color:#008" class=3D"m_3096222560286236931styled-by-prettify">auto=
</span><span style=3D"color:#000" class=3D"m_3096222560286236931styled-by-p=
rettify"> sv2 </span><span style=3D"color:#660" class=3D"m_3096222560286236=
931styled-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_3096=
222560286236931styled-by-prettify"> sv</span><span style=3D"color:#660" cla=
ss=3D"m_3096222560286236931styled-by-prettify">.</span><span style=3D"color=
:#000" class=3D"m_3096222560286236931styled-by-prettify">without_prefix</sp=
an><span style=3D"color:#660" class=3D"m_3096222560286236931styled-by-prett=
ify">(</span><span style=3D"color:#066" class=3D"m_3096222560286236931style=
d-by-prettify">2</span><span style=3D"color:#660" class=3D"m_30962225602862=
36931styled-by-prettify">);</span><span style=3D"color:#000" class=3D"m_309=
6222560286236931styled-by-prettify"><br></span><font color=3D"#880000"><spa=
n style=3D"color:#008" class=3D"m_3096222560286236931styled-by-prettify">as=
sert</span><span style=3D"color:#660" class=3D"m_3096222560286236931styled-=
by-prettify">(</span><span style=3D"color:#000" class=3D"m_3096222560286236=
931styled-by-prettify">sv2 </span><span style=3D"color:#660" class=3D"m_309=
6222560286236931styled-by-prettify">=3D=3D</span><span style=3D"color:#000"=
 class=3D"m_3096222560286236931styled-by-prettify"> </span><span style=3D"c=
olor:#080" class=3D"m_3096222560286236931styled-by-prettify">&quot;me text&=
quot;</span><span style=3D"color:#660" class=3D"m_3096222560286236931styled=
-by-prettify">);</span></font></div></code></div></div><div><br></div></div=
></blockquote><div><br></div><div>This already exists:</div><div><br></div>=
<div><div style=3D"color:rgb(0,0,0);background-color:rgb(255,255,254)"><div=
><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">    s=
td::string_view sv =3D </span><span style=3D"color:rgb(163,21,21)">&quot;so=
me text&quot;</span><span style=3D"color:rgb(0,0,0)">;</span></font></div><=
div><font face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">  =
  </span><span style=3D"color:rgb(0,0,255)">auto</span><span style=3D"color=
:rgb(0,0,0)"> sv2 =3D sv.substr(</span><span style=3D"color:rgb(9,136,90)">=
2</span><span style=3D"color:rgb(0,0,0)">);</span></font></div><div><font f=
ace=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">    assert(sv=
2 =3D=3D </span><span style=3D"color:rgb(163,21,21)">&quot;me text&quot;</s=
pan><span style=3D"color:rgb(0,0,0)">);</span></font></div><div><font face=
=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span></font></=
div></div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div di=
r=3D"ltr"><div></div><div>The function would look something like this:</div=
><div><br></div><div><div class=3D"m_3096222560286236931prettyprint" style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code class=3D"m_3096222=
560286236931prettyprint"><div class=3D"m_3096222560286236931subprettyprint"=
><span style=3D"color:#000" class=3D"m_3096222560286236931styled-by-prettif=
y">std</span><span style=3D"color:#660" class=3D"m_3096222560286236931style=
d-by-prettify">::</span><span style=3D"color:#000" class=3D"m_3096222560286=
236931styled-by-prettify">string_view without_prefix</span><span style=3D"c=
olor:#660" class=3D"m_3096222560286236931styled-by-prettify">(</span><span =
style=3D"color:#000" class=3D"m_3096222560286236931styled-by-prettify">size=
_type n</span><span style=3D"color:#660" class=3D"m_3096222560286236931styl=
ed-by-prettify">)</span><span style=3D"color:#000" class=3D"m_3096222560286=
236931styled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_309=
6222560286236931styled-by-prettify">const</span><span style=3D"color:#000" =
class=3D"m_3096222560286236931styled-by-prettify"> </span><span style=3D"co=
lor:#660" class=3D"m_3096222560286236931styled-by-prettify">{</span><span s=
tyle=3D"color:#000" class=3D"m_3096222560286236931styled-by-prettify"><br>=
=C2=A0 =C2=A0 std</span><span style=3D"color:#660" class=3D"m_3096222560286=
236931styled-by-prettify">::</span><span style=3D"color:#000" class=3D"m_30=
96222560286236931styled-by-prettify">string_view result </span><span style=
=3D"color:#660" class=3D"m_3096222560286236931styled-by-prettify">=3D</span=
><span style=3D"color:#000" class=3D"m_3096222560286236931styled-by-prettif=
y"> </span><span style=3D"color:#660" class=3D"m_3096222560286236931styled-=
by-prettify">*</span><span style=3D"color:#008" class=3D"m_3096222560286236=
931styled-by-prettify">this</span><span style=3D"color:#660" class=3D"m_309=
6222560286236931styled-by-prettify">;</span><span style=3D"color:#000" clas=
s=3D"m_3096222560286236931styled-by-prettify"><br>=C2=A0 =C2=A0 result</spa=
n><span style=3D"color:#660" class=3D"m_3096222560286236931styled-by-pretti=
fy">.</span><span style=3D"color:#000" class=3D"m_3096222560286236931styled=
-by-prettify">remove_prefix</span><span style=3D"color:#660" class=3D"m_309=
6222560286236931styled-by-prettify">(</span><span style=3D"color:#000" clas=
s=3D"m_3096222560286236931styled-by-prettify">n</span><span style=3D"color:=
#660" class=3D"m_3096222560286236931styled-by-prettify">);</span><span styl=
e=3D"color:#000" class=3D"m_3096222560286236931styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#008" class=3D"m_3096222560286236931=
styled-by-prettify">return</span><span style=3D"color:#000" class=3D"m_3096=
222560286236931styled-by-prettify"> result</span><span style=3D"color:#660"=
 class=3D"m_3096222560286236931styled-by-prettify">;</span><span style=3D"c=
olor:#000" class=3D"m_3096222560286236931styled-by-prettify"><br></span><sp=
an style=3D"color:#660" class=3D"m_3096222560286236931styled-by-prettify">}=
</span></div></code></div><br></div><div>In some cases, it can make a bigge=
r difference, especially when you mark everything as const if possible. <fo=
nt face=3D"courier new, monospace">remove_prefix,</font>=C2=A0<font face=3D=
"courier new, monospace">remove_suffix, </font><font face=3D"arial, sans-se=
rif">and</font><font face=3D"courier new, monospace"> swap=C2=A0</font><fon=
t face=3D"arial, sans-serif">are the only modifiers for string_view, so hav=
ing to mark it non-const just for the remove_*s is annoying.</font></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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/5af130c9-1394-4f6d-b80e-a08b2537f095%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5af130c9-1394-=
4f6d-b80e-a08b2537f095%40isocpp.org</a>.<br>
</blockquote></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/CALvx3hYgoi-0J105_jnvHf2bRBzxeA19szxr=
oCar7e7UFU_Y3A%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hYgoi-0J105=
_jnvHf2bRBzxeA19szxroCar7e7UFU_Y3A%40mail.gmail.com</a>.<br />

--00000000000094a9f6056fadd52a--

.


Author: Justin Bassett <jbassett271@gmail.com>
Date: Wed, 27 Jun 2018 23:29:49 -0700
Raw View
--000000000000bfc707056faddb25
Content-Type: text/plain; charset="UTF-8"

True. I wonder why remove_prefix and remove_suffix even exist...

On Wed, Jun 27, 2018 at 11:27 PM, Richard Hodges <hodges.r@gmail.com> wrote:

>
>
> On Thu, 28 Jun 2018 at 08:17, Justin Bassett <jbassett271@gmail.com>
> wrote:
>
>> I've found that I almost never want the remove_prefix or remove_suffix functions,
>> but would rather have without_* versions which return the value.
>>
>> I want to be able to write:
>>
>> std::string_view sv = "some text";
>> auto sv2 = sv.without_prefix(2);
>> assert(sv2 == "me text");
>>
>>
> This already exists:
>
> std::string_view sv = "some text";
> auto sv2 = sv.substr(2);
> assert(sv2 == "me text");
>
>
>
>> The function would look something like this:
>>
>> std::string_view without_prefix(size_type n) const {
>>     std::string_view result = *this;
>>     result.remove_prefix(n);
>>     return result;
>> }
>>
>> In some cases, it can make a bigger difference, especially when you mark
>> everything as const if possible. remove_prefix, remove_suffix, and swap are
>> the only modifiers for string_view, so having to mark it non-const just for
>> the remove_*s is annoying.
>>
>> --
>> 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
>> email 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/5af130c9-1394-4f6d-
>> b80e-a08b2537f095%40isocpp.org
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5af130c9-1394-4f6d-b80e-a08b2537f095%40isocpp.org?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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
> email 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/CALvx3hYgoi-0J105_
> jnvHf2bRBzxeA19szxroCar7e7UFU_Y3A%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hYgoi-0J105_jnvHf2bRBzxeA19szxroCar7e7UFU_Y3A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

--
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 email 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/CAPuuy5dYNRnvErCV34x6fsV_Nw0HZWBZoXxqV-VW3XVsR1B77g%40mail.gmail.com.

--000000000000bfc707056faddb25
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">True. I wonder why remove_prefix and remove_suffix even ex=
ist...</div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On We=
d, Jun 27, 2018 at 11:27 PM, Richard Hodges <span dir=3D"ltr">&lt;<a href=
=3D"mailto:hodges.r@gmail.com" target=3D"_blank">hodges.r@gmail.com</a>&gt;=
</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><br><=
div class=3D"gmail_quote"><span class=3D""><div dir=3D"ltr">On Thu, 28 Jun =
2018 at 08:17, Justin Bassett &lt;<a href=3D"mailto:jbassett271@gmail.com" =
target=3D"_blank">jbassett271@gmail.com</a>&gt; wrote:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli=
d;padding-left:1ex"><div dir=3D"ltr"><div>I&#39;ve found that I almost neve=
r want the=C2=A0<font face=3D"courier new, monospace">remove_prefix</font>=
=C2=A0or=C2=A0<font face=3D"courier new, monospace">remove_<wbr>suffix</fon=
t>=C2=A0functions, but would rather have=C2=A0<font face=3D"courier new, mo=
nospace">without_*</font>=C2=A0versions which return the value.</div><div><=
br></div>I want to be able to write:<div><br></div><div><div class=3D"m_-42=
29884342396023212m_3096222560286236931prettyprint" style=3D"background-colo=
r:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-=
width:1px;word-wrap:break-word"><code class=3D"m_-4229884342396023212m_3096=
222560286236931prettyprint"><div class=3D"m_-4229884342396023212m_309622256=
0286236931subprettyprint"><span style=3D"color:#000" class=3D"m_-4229884342=
396023212m_3096222560286236931styled-by-prettify">std</span><span style=3D"=
color:#660" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-p=
rettify">::</span><span style=3D"color:#000" class=3D"m_-422988434239602321=
2m_3096222560286236931styled-by-prettify">string_view sv </span><span style=
=3D"color:#660" class=3D"m_-4229884342396023212m_3096222560286236931styled-=
by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_-4229884342396=
023212m_3096222560286236931styled-by-prettify"> </span><span style=3D"color=
:#080" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-pretti=
fy">&quot;some text&quot;</span><span style=3D"color:#660" class=3D"m_-4229=
884342396023212m_3096222560286236931styled-by-prettify">;</span><span style=
=3D"color:#000" class=3D"m_-4229884342396023212m_3096222560286236931styled-=
by-prettify"><br></span><span style=3D"color:#008" class=3D"m_-422988434239=
6023212m_3096222560286236931styled-by-prettify">auto</span><span style=3D"c=
olor:#000" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-pr=
ettify"> sv2 </span><span style=3D"color:#660" class=3D"m_-4229884342396023=
212m_3096222560286236931styled-by-prettify">=3D</span><span style=3D"color:=
#000" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-prettif=
y"> sv</span><span style=3D"color:#660" class=3D"m_-4229884342396023212m_30=
96222560286236931styled-by-prettify">.</span><span style=3D"color:#000" cla=
ss=3D"m_-4229884342396023212m_3096222560286236931styled-by-prettify">withou=
t_prefix</span><span style=3D"color:#660" class=3D"m_-4229884342396023212m_=
3096222560286236931styled-by-prettify">(</span><span style=3D"color:#066" c=
lass=3D"m_-4229884342396023212m_3096222560286236931styled-by-prettify">2</s=
pan><span style=3D"color:#660" class=3D"m_-4229884342396023212m_30962225602=
86236931styled-by-prettify">);</span><span style=3D"color:#000" class=3D"m_=
-4229884342396023212m_3096222560286236931styled-by-prettify"><br></span><fo=
nt color=3D"#880000"><span style=3D"color:#008" class=3D"m_-422988434239602=
3212m_3096222560286236931styled-by-prettify">assert</span><span style=3D"co=
lor:#660" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-pre=
ttify">(</span><span style=3D"color:#000" class=3D"m_-4229884342396023212m_=
3096222560286236931styled-by-prettify">sv2 </span><span style=3D"color:#660=
" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-prettify">=
=3D=3D</span><span style=3D"color:#000" class=3D"m_-4229884342396023212m_30=
96222560286236931styled-by-prettify"> </span><span style=3D"color:#080" cla=
ss=3D"m_-4229884342396023212m_3096222560286236931styled-by-prettify">&quot;=
me text&quot;</span><span style=3D"color:#660" class=3D"m_-4229884342396023=
212m_3096222560286236931styled-by-prettify">);</span></font></div></code></=
div></div><div><br></div></div></blockquote><div><br></div></span><div>This=
 already exists:</div><div><br></div><div><div style=3D"color:rgb(0,0,0);ba=
ckground-color:rgb(255,255,254)"><span class=3D""><div><font face=3D"monosp=
ace, monospace"><span style=3D"color:rgb(0,0,0)">    std::string_view sv =
=3D </span><span style=3D"color:rgb(163,21,21)">&quot;some text&quot;</span=
><span style=3D"color:rgb(0,0,0)">;</span></font></div></span><div><font fa=
ce=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">    </span><sp=
an style=3D"color:rgb(0,0,255)">auto</span><span style=3D"color:rgb(0,0,0)"=
> sv2 =3D sv.substr(</span><span style=3D"color:rgb(9,136,90)">2</span><spa=
n style=3D"color:rgb(0,0,0)">);</span></font></div><span class=3D""><div><f=
ont face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">    asse=
rt(sv2 =3D=3D </span><span style=3D"color:rgb(163,21,21)">&quot;me text&quo=
t;</span><span style=3D"color:rgb(0,0,0)">);</span></font></div><div><font =
face=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)"></span></fon=
t></div></span></div><br></div><span class=3D""><div>=C2=A0</div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc sol=
id;padding-left:1ex"><div dir=3D"ltr"><div></div><div>The function would lo=
ok something like this:</div><div><br></div><div><div class=3D"m_-422988434=
2396023212m_3096222560286236931prettyprint" style=3D"background-color:rgb(2=
50,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1=
px;word-wrap:break-word"><code class=3D"m_-4229884342396023212m_30962225602=
86236931prettyprint"><div class=3D"m_-4229884342396023212m_3096222560286236=
931subprettyprint"><span style=3D"color:#000" class=3D"m_-42298843423960232=
12m_3096222560286236931styled-by-prettify">std</span><span style=3D"color:#=
660" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-prettify=
">::</span><span style=3D"color:#000" class=3D"m_-4229884342396023212m_3096=
222560286236931styled-by-prettify">string_view without_prefix</span><span s=
tyle=3D"color:#660" class=3D"m_-4229884342396023212m_3096222560286236931sty=
led-by-prettify">(</span><span style=3D"color:#000" class=3D"m_-42298843423=
96023212m_3096222560286236931styled-by-prettify">size_type n</span><span st=
yle=3D"color:#660" class=3D"m_-4229884342396023212m_3096222560286236931styl=
ed-by-prettify">)</span><span style=3D"color:#000" class=3D"m_-422988434239=
6023212m_3096222560286236931styled-by-prettify"> </span><span style=3D"colo=
r:#008" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-prett=
ify">const</span><span style=3D"color:#000" class=3D"m_-4229884342396023212=
m_3096222560286236931styled-by-prettify"> </span><span style=3D"color:#660"=
 class=3D"m_-4229884342396023212m_3096222560286236931styled-by-prettify">{<=
/span><span style=3D"color:#000" class=3D"m_-4229884342396023212m_309622256=
0286236931styled-by-prettify"><br>=C2=A0 =C2=A0 std</span><span style=3D"co=
lor:#660" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-pre=
ttify">::</span><span style=3D"color:#000" class=3D"m_-4229884342396023212m=
_3096222560286236931styled-by-prettify">string_view result </span><span sty=
le=3D"color:#660" class=3D"m_-4229884342396023212m_3096222560286236931style=
d-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_-42298843423=
96023212m_3096222560286236931styled-by-prettify"> </span><span style=3D"col=
or:#660" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-pret=
tify">*</span><span style=3D"color:#008" class=3D"m_-4229884342396023212m_3=
096222560286236931styled-by-prettify">this</span><span style=3D"color:#660"=
 class=3D"m_-4229884342396023212m_3096222560286236931styled-by-prettify">;<=
/span><span style=3D"color:#000" class=3D"m_-4229884342396023212m_309622256=
0286236931styled-by-prettify"><br>=C2=A0 =C2=A0 result</span><span style=3D=
"color:#660" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-=
prettify">.</span><span style=3D"color:#000" class=3D"m_-422988434239602321=
2m_3096222560286236931styled-by-prettify">remove_prefix</span><span style=
=3D"color:#660" class=3D"m_-4229884342396023212m_3096222560286236931styled-=
by-prettify">(</span><span style=3D"color:#000" class=3D"m_-422988434239602=
3212m_3096222560286236931styled-by-prettify">n</span><span style=3D"color:#=
660" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-prettify=
">);</span><span style=3D"color:#000" class=3D"m_-4229884342396023212m_3096=
222560286236931styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"=
color:#008" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-p=
rettify">return</span><span style=3D"color:#000" class=3D"m_-42298843423960=
23212m_3096222560286236931styled-by-prettify"> result</span><span style=3D"=
color:#660" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-p=
rettify">;</span><span style=3D"color:#000" class=3D"m_-4229884342396023212=
m_3096222560286236931styled-by-prettify"><br></span><span style=3D"color:#6=
60" class=3D"m_-4229884342396023212m_3096222560286236931styled-by-prettify"=
>}</span></div></code></div><br></div><div>In some cases, it can make a big=
ger difference, especially when you mark everything as const if possible. <=
font face=3D"courier new, monospace">remove_prefix,</font>=C2=A0<font face=
=3D"courier new, monospace">remove_suffix, </font><font face=3D"arial, sans=
-serif">and</font><font face=3D"courier new, monospace"> swap=C2=A0</font><=
font face=3D"arial, sans-serif">are the only modifiers for string_view, so =
having to mark it non-const just for the remove_*s is annoying.</font></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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/5af130c9-1394-4f6d-b80e-a08b2537f095%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/5af1=
30c9-1394-4f6d-<wbr>b80e-a08b2537f095%40isocpp.org</a><wbr>.<br>
</blockquote></span></div></div><span class=3D"">

<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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CALvx3hYgoi-0J105_jnvHf2bRBzxeA19szxr=
oCar7e7UFU_Y3A%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfooter"=
 target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-=
<wbr>proposals/CALvx3hYgoi-0J105_<wbr>jnvHf2bRBzxeA19szxroCar7e7UFU_<wbr>Y3=
A%40mail.gmail.com</a>.<br>
</blockquote></div><br></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/CAPuuy5dYNRnvErCV34x6fsV_Nw0HZWBZoXxq=
V-VW3XVsR1B77g%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPuuy5dYNRnvErCV=
34x6fsV_Nw0HZWBZoXxqV-VW3XVsR1B77g%40mail.gmail.com</a>.<br />

--000000000000bfc707056faddb25--

.


Author: Richard Hodges <hodges.r@gmail.com>
Date: Thu, 28 Jun 2018 09:50:29 +0200
Raw View
--000000000000e5b292056faefc73
Content-Type: text/plain; charset="UTF-8"

On Thu, 28 Jun 2018 at 08:29, Justin Bassett <jbassett271@gmail.com> wrote:

> True. I wonder why remove_prefix and remove_suffix even exist...
>

If I were to guess, I'd say that they offer functionality similar to
std::basic_string::erase, but dissimilar enough to warrant a different name.

That is, they perform in-place manipulation of the string_view, rather than
taking a modified copy.

There is a further difference, which only occurred to me while
experimenting on godbolt, which is that the xxx_prefix functions do not
throw if preconditions are not met, they merely exhibit UB. So there is a
performance benefit in using the in_place forms.

example:
https://godbolt.org/g/Gf39Fo

std::string_view chop1(std::string_view sv, std::size_t n)
{
    // this may throw and involves a conditional branch
    return sv.substr(n);
}

std::string_view chop2(std::string_view sv, std::size_t n)
{
    // this won't throw but may result in UB
    sv.remove_prefix(n);
    return sv;
}



>
> On Wed, Jun 27, 2018 at 11:27 PM, Richard Hodges <hodges.r@gmail.com>
> wrote:
>
>>
>>
>> On Thu, 28 Jun 2018 at 08:17, Justin Bassett <jbassett271@gmail.com>
>> wrote:
>>
>>> I've found that I almost never want the remove_prefix or remove_suffix functions,
>>> but would rather have without_* versions which return the value.
>>>
>>> I want to be able to write:
>>>
>>> std::string_view sv = "some text";
>>> auto sv2 = sv.without_prefix(2);
>>> assert(sv2 == "me text");
>>>
>>>
>> This already exists:
>>
>> std::string_view sv = "some text";
>> auto sv2 = sv.substr(2);
>> assert(sv2 == "me text");
>>
>>
>>
>>> The function would look something like this:
>>>
>>> std::string_view without_prefix(size_type n) const {
>>>     std::string_view result = *this;
>>>     result.remove_prefix(n);
>>>     return result;
>>> }
>>>
>>> In some cases, it can make a bigger difference, especially when you mark
>>> everything as const if possible. remove_prefix, remove_suffix, and swap are
>>> the only modifiers for string_view, so having to mark it non-const just for
>>> the remove_*s is annoying.
>>>
>>> --
>>> 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 email 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/5af130c9-1394-4f6d-b80e-a08b2537f095%40isocpp.org
>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5af130c9-1394-4f6d-b80e-a08b2537f095%40isocpp.org?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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
>> email 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/CALvx3hYgoi-0J105_jnvHf2bRBzxeA19szxroCar7e7UFU_Y3A%40mail.gmail.com
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hYgoi-0J105_jnvHf2bRBzxeA19szxroCar7e7UFU_Y3A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
> --
> 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
> email 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/CAPuuy5dYNRnvErCV34x6fsV_Nw0HZWBZoXxqV-VW3XVsR1B77g%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPuuy5dYNRnvErCV34x6fsV_Nw0HZWBZoXxqV-VW3XVsR1B77g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

--
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 email 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/CALvx3hZ5LZzNx2x5nrLX1tTjpFwtcJsQEEBgkNa3KphL%3D7vN5Q%40mail.gmail.com.

--000000000000e5b292056faefc73
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Thu=
, 28 Jun 2018 at 08:29, Justin Bassett &lt;<a href=3D"mailto:jbassett271@gm=
ail.com">jbassett271@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D=
"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(2=
04,204,204);padding-left:1ex"><div dir=3D"ltr">True. I wonder why remove_pr=
efix and remove_suffix even exist...</div></blockquote><div><br></div><div>=
If I were to guess, I&#39;d say that they offer functionality similar to st=
d::basic_string::erase, but dissimilar enough to warrant a different name.<=
/div><div><br></div><div>That is, they perform in-place manipulation of the=
 string_view, rather than taking a modified copy.</div><div><br></div><div>=
There is a further difference, which only occurred to me while experimentin=
g on godbolt, which is that the xxx_prefix functions do not throw if precon=
ditions are not met, they merely exhibit UB. So there is a performance bene=
fit in using the in_place forms.</div><div><br></div><div>example:</div><di=
v><a href=3D"https://godbolt.org/g/Gf39Fo">https://godbolt.org/g/Gf39Fo</a>=
<br></div><div><br></div><div><div><font face=3D"monospace, monospace">std:=
:string_view chop1(std::string_view sv, std::size_t n)</font></div><div><fo=
nt face=3D"monospace, monospace">{</font></div><div><font face=3D"monospace=
, monospace">=C2=A0 =C2=A0 // this may throw and involves a conditional bra=
nch</font></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 retu=
rn sv.substr(n);</font></div><div><font face=3D"monospace, monospace">}</fo=
nt></div><div><font face=3D"monospace, monospace"><br></font></div><div><fo=
nt face=3D"monospace, monospace">std::string_view chop2(std::string_view sv=
, std::size_t n)</font></div><div><font face=3D"monospace, monospace">{</fo=
nt></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 // this won=
&#39;t throw but may result in UB</font></div><div><font face=3D"monospace,=
 monospace">=C2=A0 =C2=A0 sv.remove_prefix(n);</font></div><div><font face=
=3D"monospace, monospace">=C2=A0 =C2=A0 return sv;</font></div><div><font f=
ace=3D"monospace, monospace">}</font></div></div><div><br></div><div>=C2=A0=
<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=3D"g=
mail_extra"><br><div class=3D"gmail_quote">On Wed, Jun 27, 2018 at 11:27 PM=
, Richard Hodges <span dir=3D"ltr">&lt;<a href=3D"mailto:hodges.r@gmail.com=
" target=3D"_blank">hodges.r@gmail.com</a>&gt;</span> wrote:<br><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><br><br><div class=
=3D"gmail_quote"><span><div dir=3D"ltr">On Thu, 28 Jun 2018 at 08:17, Justi=
n Bassett &lt;<a href=3D"mailto:jbassett271@gmail.com" target=3D"_blank">jb=
assett271@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quot=
e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)=
;padding-left:1ex"><div dir=3D"ltr"><div>I&#39;ve found that I almost never=
 want the=C2=A0<font face=3D"courier new, monospace">remove_prefix</font>=
=C2=A0or=C2=A0<font face=3D"courier new, monospace">remove_suffix</font>=C2=
=A0functions, but would rather have=C2=A0<font face=3D"courier new, monospa=
ce">without_*</font>=C2=A0versions which return the value.</div><div><br></=
div>I want to be able to write:<div><br></div><div><div class=3D"gmail-m_84=
68566406087855139m_-4229884342396023212m_3096222560286236931prettyprint" st=
yle=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bord=
er-style:solid;border-width:1px;word-wrap:break-word"><code class=3D"gmail-=
m_8468566406087855139m_-4229884342396023212m_3096222560286236931prettyprint=
"><div class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_30962225=
60286236931subprettyprint"><span style=3D"color:rgb(0,0,0)" class=3D"gmail-=
m_8468566406087855139m_-4229884342396023212m_3096222560286236931styled-by-p=
rettify">std</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_84=
68566406087855139m_-4229884342396023212m_3096222560286236931styled-by-prett=
ify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_84685664060=
87855139m_-4229884342396023212m_3096222560286236931styled-by-prettify">stri=
ng_view sv </span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_846=
8566406087855139m_-4229884342396023212m_3096222560286236931styled-by-pretti=
fy">=3D</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_84685664060=
87855139m_-4229884342396023212m_3096222560286236931styled-by-prettify"> </s=
pan><span style=3D"color:rgb(0,136,0)" class=3D"gmail-m_8468566406087855139=
m_-4229884342396023212m_3096222560286236931styled-by-prettify">&quot;some t=
ext&quot;</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_84685=
66406087855139m_-4229884342396023212m_3096222560286236931styled-by-prettify=
">;</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_846856640608785=
5139m_-4229884342396023212m_3096222560286236931styled-by-prettify"><br></sp=
an><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_8468566406087855139m=
_-4229884342396023212m_3096222560286236931styled-by-prettify">auto</span><s=
pan style=3D"color:rgb(0,0,0)" class=3D"gmail-m_8468566406087855139m_-42298=
84342396023212m_3096222560286236931styled-by-prettify"> sv2 </span><span st=
yle=3D"color:rgb(102,102,0)" class=3D"gmail-m_8468566406087855139m_-4229884=
342396023212m_3096222560286236931styled-by-prettify">=3D</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_8468566406087855139m_-42298843423960=
23212m_3096222560286236931styled-by-prettify"> sv</span><span style=3D"colo=
r:rgb(102,102,0)" class=3D"gmail-m_8468566406087855139m_-422988434239602321=
2m_3096222560286236931styled-by-prettify">.</span><span style=3D"color:rgb(=
0,0,0)" class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_3096222=
560286236931styled-by-prettify">without_prefix</span><span style=3D"color:r=
gb(102,102,0)" class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_=
3096222560286236931styled-by-prettify">(</span><span style=3D"color:rgb(0,1=
02,102)" class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_309622=
2560286236931styled-by-prettify">2</span><span style=3D"color:rgb(102,102,0=
)" class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_309622256028=
6236931styled-by-prettify">);</span><span style=3D"color:rgb(0,0,0)" class=
=3D"gmail-m_8468566406087855139m_-4229884342396023212m_3096222560286236931s=
tyled-by-prettify"><br></span><font color=3D"#880000"><span style=3D"color:=
rgb(0,0,136)" class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_3=
096222560286236931styled-by-prettify">assert</span><span style=3D"color:rgb=
(102,102,0)" class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_30=
96222560286236931styled-by-prettify">(</span><span style=3D"color:rgb(0,0,0=
)" class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_309622256028=
6236931styled-by-prettify">sv2 </span><span style=3D"color:rgb(102,102,0)" =
class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_309622256028623=
6931styled-by-prettify">=3D=3D</span><span style=3D"color:rgb(0,0,0)" class=
=3D"gmail-m_8468566406087855139m_-4229884342396023212m_3096222560286236931s=
tyled-by-prettify"> </span><span style=3D"color:rgb(0,136,0)" class=3D"gmai=
l-m_8468566406087855139m_-4229884342396023212m_3096222560286236931styled-by=
-prettify">&quot;me text&quot;</span><span style=3D"color:rgb(102,102,0)" c=
lass=3D"gmail-m_8468566406087855139m_-4229884342396023212m_3096222560286236=
931styled-by-prettify">);</span></font></div></code></div></div><div><br></=
div></div></blockquote><div><br></div></span><div>This already exists:</div=
><div><br></div><div><div style=3D"color:rgb(0,0,0);background-color:rgb(25=
5,255,254)"><span><div><font face=3D"monospace, monospace"><span style=3D"c=
olor:rgb(0,0,0)">    std::string_view sv =3D </span><span style=3D"color:rg=
b(163,21,21)">&quot;some text&quot;</span><span style=3D"color:rgb(0,0,0)">=
;</span></font></div></span><div><font face=3D"monospace, monospace"><span =
style=3D"color:rgb(0,0,0)">    </span><span style=3D"color:rgb(0,0,255)">au=
to</span><span style=3D"color:rgb(0,0,0)"> sv2 =3D sv.substr(</span><span s=
tyle=3D"color:rgb(9,136,90)">2</span><span style=3D"color:rgb(0,0,0)">);</s=
pan></font></div><span><div><font face=3D"monospace, monospace"><span style=
=3D"color:rgb(0,0,0)">    assert(sv2 =3D=3D </span><span style=3D"color:rgb=
(163,21,21)">&quot;me text&quot;</span><span style=3D"color:rgb(0,0,0)">);<=
/span></font></div><div><font face=3D"monospace, monospace"><span style=3D"=
color:rgb(0,0,0)"></span></font></div></span></div><br></div><span><div>=C2=
=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"=
><div></div><div>The function would look something like this:</div><div><br=
></div><div><div class=3D"gmail-m_8468566406087855139m_-4229884342396023212=
m_3096222560286236931prettyprint" style=3D"background-color:rgb(250,250,250=
);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wr=
ap:break-word"><code class=3D"gmail-m_8468566406087855139m_-422988434239602=
3212m_3096222560286236931prettyprint"><div class=3D"gmail-m_846856640608785=
5139m_-4229884342396023212m_3096222560286236931subprettyprint"><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_8468566406087855139m_-42298843423960=
23212m_3096222560286236931styled-by-prettify">std</span><span style=3D"colo=
r:rgb(102,102,0)" class=3D"gmail-m_8468566406087855139m_-422988434239602321=
2m_3096222560286236931styled-by-prettify">::</span><span style=3D"color:rgb=
(0,0,0)" class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_309622=
2560286236931styled-by-prettify">string_view without_prefix</span><span sty=
le=3D"color:rgb(102,102,0)" class=3D"gmail-m_8468566406087855139m_-42298843=
42396023212m_3096222560286236931styled-by-prettify">(</span><span style=3D"=
color:rgb(0,0,0)" class=3D"gmail-m_8468566406087855139m_-422988434239602321=
2m_3096222560286236931styled-by-prettify">size_type n</span><span style=3D"=
color:rgb(102,102,0)" class=3D"gmail-m_8468566406087855139m_-42298843423960=
23212m_3096222560286236931styled-by-prettify">)</span><span style=3D"color:=
rgb(0,0,0)" class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_309=
6222560286236931styled-by-prettify"> </span><span style=3D"color:rgb(0,0,13=
6)" class=3D"gmail-m_8468566406087855139m_-4229884342396023212m_30962225602=
86236931styled-by-prettify">const</span><span style=3D"color:rgb(0,0,0)" cl=
ass=3D"gmail-m_8468566406087855139m_-4229884342396023212m_30962225602862369=
31styled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D=
"gmail-m_8468566406087855139m_-4229884342396023212m_3096222560286236931styl=
ed-by-prettify">{</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_8=
468566406087855139m_-4229884342396023212m_3096222560286236931styled-by-pret=
tify"><br>=C2=A0 =C2=A0 std</span><span style=3D"color:rgb(102,102,0)" clas=
s=3D"gmail-m_8468566406087855139m_-4229884342396023212m_3096222560286236931=
styled-by-prettify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"gmai=
l-m_8468566406087855139m_-4229884342396023212m_3096222560286236931styled-by=
-prettify">string_view result </span><span style=3D"color:rgb(102,102,0)" c=
lass=3D"gmail-m_8468566406087855139m_-4229884342396023212m_3096222560286236=
931styled-by-prettify">=3D</span><span style=3D"color:rgb(0,0,0)" class=3D"=
gmail-m_8468566406087855139m_-4229884342396023212m_3096222560286236931style=
d-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-=
m_8468566406087855139m_-4229884342396023212m_3096222560286236931styled-by-p=
rettify">*</span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_846856=
6406087855139m_-4229884342396023212m_3096222560286236931styled-by-prettify"=
>this</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_846856640=
6087855139m_-4229884342396023212m_3096222560286236931styled-by-prettify">;<=
/span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_8468566406087855139=
m_-4229884342396023212m_3096222560286236931styled-by-prettify"><br>=C2=A0 =
=C2=A0 result</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_8=
468566406087855139m_-4229884342396023212m_3096222560286236931styled-by-pret=
tify">.</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_84685664060=
87855139m_-4229884342396023212m_3096222560286236931styled-by-prettify">remo=
ve_prefix</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_84685=
66406087855139m_-4229884342396023212m_3096222560286236931styled-by-prettify=
">(</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_846856640608785=
5139m_-4229884342396023212m_3096222560286236931styled-by-prettify">n</span>=
<span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_8468566406087855139m_=
-4229884342396023212m_3096222560286236931styled-by-prettify">);</span><span=
 style=3D"color:rgb(0,0,0)" class=3D"gmail-m_8468566406087855139m_-42298843=
42396023212m_3096222560286236931styled-by-prettify"><br>=C2=A0 =C2=A0 </spa=
n><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_8468566406087855139m_=
-4229884342396023212m_3096222560286236931styled-by-prettify">return</span><=
span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_8468566406087855139m_-4229=
884342396023212m_3096222560286236931styled-by-prettify"> result</span><span=
 style=3D"color:rgb(102,102,0)" class=3D"gmail-m_8468566406087855139m_-4229=
884342396023212m_3096222560286236931styled-by-prettify">;</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_8468566406087855139m_-42298843423960=
23212m_3096222560286236931styled-by-prettify"><br></span><span style=3D"col=
or:rgb(102,102,0)" class=3D"gmail-m_8468566406087855139m_-42298843423960232=
12m_3096222560286236931styled-by-prettify">}</span></div></code></div><br><=
/div><div>In some cases, it can make a bigger difference, especially when y=
ou mark everything as const if possible. <font face=3D"courier new, monospa=
ce">remove_prefix,</font>=C2=A0<font face=3D"courier new, monospace">remove=
_suffix, </font><font face=3D"arial, sans-serif">and</font><font face=3D"co=
urier new, monospace"> swap=C2=A0</font><font face=3D"arial, sans-serif">ar=
e the only modifiers for string_view, so having to mark it non-const just f=
or the remove_*s is annoying.</font></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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/5af130c9-1394-4f6d-b80e-a08b2537f095%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5af130c9-1394-=
4f6d-b80e-a08b2537f095%40isocpp.org</a>.<br>
</blockquote></span></div></div><span>

<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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CALvx3hYgoi-0J105_jnvHf2bRBzxeA19szxr=
oCar7e7UFU_Y3A%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfooter"=
 target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std-propo=
sals/CALvx3hYgoi-0J105_jnvHf2bRBzxeA19szxroCar7e7UFU_Y3A%40mail.gmail.com</=
a>.<br>
</blockquote></div><br></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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/CAPuuy5dYNRnvErCV34x6fsV_Nw0HZWBZoXxq=
V-VW3XVsR1B77g%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfooter"=
 target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std-propo=
sals/CAPuuy5dYNRnvErCV34x6fsV_Nw0HZWBZoXxqV-VW3XVsR1B77g%40mail.gmail.com</=
a>.<br>
</blockquote></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/CALvx3hZ5LZzNx2x5nrLX1tTjpFwtcJsQEEBg=
kNa3KphL%3D7vN5Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hZ5LZzNx2=
x5nrLX1tTjpFwtcJsQEEBgkNa3KphL%3D7vN5Q%40mail.gmail.com</a>.<br />

--000000000000e5b292056faefc73--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 28 Jun 2018 06:17:42 -0700 (PDT)
Raw View
------=_Part_3709_315694537.1530191863108
Content-Type: multipart/alternative;
 boundary="----=_Part_3710_1924328072.1530191863108"

------=_Part_3710_1924328072.1530191863108
Content-Type: text/plain; charset="UTF-8"



On Thursday, June 28, 2018 at 2:28:08 AM UTC-4, Richard Hodges wrote:
>
>
>
> On Thu, 28 Jun 2018 at 08:17, Justin Bassett <jbass...@gmail.com
> <javascript:>> wrote:
>
>> I've found that I almost never want the remove_prefix or remove_suffix functions,
>> but would rather have without_* versions which return the value.
>>
>> I want to be able to write:
>>
>> std::string_view sv = "some text";
>> auto sv2 = sv.without_prefix(2);
>> assert(sv2 == "me text");
>>
>>
> This already exists:
>
> std::string_view sv = "some text";
> auto sv2 = sv.substr(2);
> assert(sv2 == "me text");
>

For the prefix case, but not the suffix case.

--
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 email 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/59a88fe1-030e-466d-b59a-170c29d6cd8b%40isocpp.org.

------=_Part_3710_1924328072.1530191863108
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Thursday, June 28, 2018 at 2:28:08 AM UTC-4, Ri=
chard Hodges wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Thu, 28 Jun 20=
18 at 08:17, Justin Bassett &lt;<a href=3D"javascript:" target=3D"_blank" g=
df-obfuscated-mailto=3D"ftJ-ycgRCQAJ" rel=3D"nofollow" onmousedown=3D"this.=
href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;java=
script:&#39;;return true;">jbass...@gmail.com</a>&gt; wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"ltr"><div>I&#39;ve found that I almos=
t never want the=C2=A0<font face=3D"courier new, monospace">remove_prefix</=
font>=C2=A0or=C2=A0<font face=3D"courier new, monospace">remove_<wbr>suffix=
</font>=C2=A0functions, but would rather have=C2=A0<font face=3D"courier ne=
w, monospace">without_*</font>=C2=A0versions which return the value.</div><=
div><br></div>I want to be able to write:<div><br></div><div><div style=3D"=
background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-styl=
e:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"co=
lor:#000">std</span><span style=3D"color:#660">::</span><span style=3D"colo=
r:#000">string_view sv </span><span style=3D"color:#660">=3D</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#080">&quot;some text&quot;=
</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br></=
span><span style=3D"color:#008">auto</span><span style=3D"color:#000"> sv2 =
</span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> sv<=
/span><span style=3D"color:#660">.</span><span style=3D"color:#000">without=
_prefix</span><span style=3D"color:#660">(</span><span style=3D"color:#066"=
>2</span><span style=3D"color:#660">);</span><span style=3D"color:#000"><br=
></span><font color=3D"#880000"><span style=3D"color:#008">assert</span><sp=
an style=3D"color:#660">(</span><span style=3D"color:#000">sv2 </span><span=
 style=3D"color:#660">=3D=3D</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#080">&quot;me text&quot;</span><span style=3D"color:#660">=
);</span></font></div></code></div></div><div><br></div></div></blockquote>=
<div><br></div><div>This already exists:</div><div><br></div><div><div styl=
e=3D"color:rgb(0,0,0);background-color:rgb(255,255,254)"><div><font face=3D=
"monospace, monospace"><span style=3D"color:rgb(0,0,0)">    std::string_vie=
w sv =3D </span><span style=3D"color:rgb(163,21,21)">&quot;some text&quot;<=
/span><span style=3D"color:rgb(0,0,0)">;</span></font></div><div><font face=
=3D"monospace, monospace"><span style=3D"color:rgb(0,0,0)">    </span><span=
 style=3D"color:rgb(0,0,255)">auto</span><span style=3D"color:rgb(0,0,0)"> =
sv2 =3D sv.substr(</span><span style=3D"color:rgb(9,136,90)">2</span><span =
style=3D"color:rgb(0,0,0)">);</span></font></div><div><font face=3D"monospa=
ce, monospace"><span style=3D"color:rgb(0,0,0)">    assert(sv2 =3D=3D </spa=
n><span style=3D"color:rgb(163,21,21)">&quot;me text&quot;</span><span styl=
e=3D"color:rgb(0,0,0)">);</span></font></div></div></div></div></div></bloc=
kquote><div><br></div><div>For the prefix case, but not the suffix case.</d=
iv><br></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/59a88fe1-030e-466d-b59a-170c29d6cd8b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/59a88fe1-030e-466d-b59a-170c29d6cd8b=
%40isocpp.org</a>.<br />

------=_Part_3710_1924328072.1530191863108--

------=_Part_3709_315694537.1530191863108--

.


Author: olafvdspek@gmail.com
Date: Fri, 13 Jul 2018 02:25:39 -0700 (PDT)
Raw View
------=_Part_113649_1222287196.1531473939568
Content-Type: multipart/alternative;
 boundary="----=_Part_113650_1755989151.1531473939568"

------=_Part_113650_1755989151.1531473939568
Content-Type: text/plain; charset="UTF-8"

Op donderdag 28 juni 2018 15:17:43 UTC+2 schreef Nicol Bolas:
>
> For the prefix case, but not the suffix case.
>
>
sv.substr(0, sv.size() - 2) ?

--
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 email 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/a0225cd2-d743-4c3e-a70c-d869f6970514%40isocpp.org.

------=_Part_113650_1755989151.1531473939568
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Op donderdag 28 juni 2018 15:17:43 UTC+2 schreef Nicol Bol=
as:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;=
border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>For t=
he prefix case, but not the suffix case.</div><br></div></blockquote><div><=
br></div><div>sv.substr(0, sv.size() - 2) ?</div><div><br></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/a0225cd2-d743-4c3e-a70c-d869f6970514%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a0225cd2-d743-4c3e-a70c-d869f6970514=
%40isocpp.org</a>.<br />

------=_Part_113650_1755989151.1531473939568--

------=_Part_113649_1222287196.1531473939568--

.