Topic: string + string_view operator


Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Tue, 3 Jan 2017 02:40:09 -0800 (PST)
Raw View
------=_Part_2426_361657658.1483440009535
Content-Type: multipart/alternative;
 boundary="----=_Part_2427_1259845207.1483440009535"

------=_Part_2427_1259845207.1483440009535
Content-Type: text/plain; charset=UTF-8

Hi,

const char* c;
std::string s;
std::string_view sv;

s + s; // valid
s + c; // valid
c + s; // valid
s += sv; // valid
s + sv; // invalid
sv + s; // invalid
sv + sv; // invalid

Tested on VS2017 RC..
I didn't track string_view status but it seems we're missing a few
operators. Have they been proposed already? Is this intentional?

Gr,
Olaf

--
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/39337915-0e61-457a-a1fa-33bae5823f69%40isocpp.org.

------=_Part_2427_1259845207.1483440009535
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi,</div><div><br></div><div>const char* c;</div><div=
>std::string s;</div><div>std::string_view sv;</div><div><br></div><div>s +=
 s; // valid</div><div>s + c; // valid</div><div>c + s; // valid</div><div>=
s +=3D sv; // valid</div><div>s + sv; // invalid</div><div>sv + s; // inval=
id</div><div>sv + sv; // invalid</div><div><br></div><div>Tested on VS2017 =
RC..</div><div>I didn&#39;t track string_view status but it seems we&#39;re=
 missing a few operators. Have they been proposed already? Is this intentio=
nal?</div><div><br></div><div>Gr,</div><div>Olaf</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/39337915-0e61-457a-a1fa-33bae5823f69%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/39337915-0e61-457a-a1fa-33bae5823f69=
%40isocpp.org</a>.<br />

------=_Part_2427_1259845207.1483440009535--

------=_Part_2426_361657658.1483440009535--

.


Author: Bo Persson <bop@gmb.dk>
Date: Tue, 3 Jan 2017 17:02:42 +0100
Raw View
On 2017-01-03 11:40, Olaf van der Spek wrote:
> Hi,
>
> const char* c;
> std::string s;
> std::string_view sv;
>
> s + s; // valid
> s + c; // valid
> c + s; // valid
> s += sv; // valid
> s + sv; // invalid
> sv + s; // invalid
> sv + sv; // invalid
>
> Tested on VS2017 RC..
> I didn't track string_view status but it seems we're missing a few
> operators. Have they been proposed already? Is this intentional?
>

Haven't seen any proposals for that. Considering that we already have 12
overloads for operator+, perhaps people are reluctant to add even more?


     Bo Persson



--
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/o4ghus%24c69%241%40blaine.gmane.org.

.


Author: lnaltidev@gmail.com
Date: Tue, 3 Jan 2017 09:15:07 -0800 (PST)
Raw View
------=_Part_2526_974974653.1483463707226
Content-Type: multipart/alternative;
 boundary="----=_Part_2527_1763720112.1483463707227"

------=_Part_2527_1763720112.1483463707227
Content-Type: text/plain; charset=UTF-8

Hello,

Perhaps some information here
https://groups.google.com/a/isocpp.org/forum/?utm_medium=email&utm_source=footer#!topic/std-proposals/1RcShRhrmRc

--
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/c6621b51-6d5a-40e5-a828-60a06013048a%40isocpp.org.

------=_Part_2527_1763720112.1483463707227
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<div><br></div><div>Perhaps some information here=C2=
=A0</div><div><a href=3D"https://groups.google.com/a/isocpp.org/forum/?utm_=
medium=3Demail&amp;utm_source=3Dfooter#!topic/std-proposals/1RcShRhrmRc">ht=
tps://groups.google.com/a/isocpp.org/forum/?utm_medium=3Demail&amp;utm_sour=
ce=3Dfooter#!topic/std-proposals/1RcShRhrmRc</a></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/c6621b51-6d5a-40e5-a828-60a06013048a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c6621b51-6d5a-40e5-a828-60a06013048a=
%40isocpp.org</a>.<br />

------=_Part_2527_1763720112.1483463707227--

------=_Part_2526_974974653.1483463707226--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 3 Jan 2017 09:30:17 -0800 (PST)
Raw View
------=_Part_1151_574821793.1483464617772
Content-Type: multipart/alternative;
 boundary="----=_Part_1152_1600780456.1483464617772"

------=_Part_1152_1600780456.1483464617772
Content-Type: text/plain; charset=UTF-8

On Tuesday, January 3, 2017 at 12:15:07 PM UTC-5, lnal...@gmail.com wrote:
>
> Hello,
>
> Perhaps some information here
>
> https://groups.google.com/a/isocpp.org/forum/?utm_medium=email&utm_source=footer#!topic/std-proposals/1RcShRhrmRc
>

That post gives a good reason for why not to have such an overload: to
eventually support lazy evaluation. If you implement non-lazy operations
now, then they will be non-lazy... forever.

That being said, you could still provoke non-lazy evaluation in cases where
you're only combining `string_view`. So if you want lazy-evaluation, you
would construct a `string_view` from the `std::string`. This would also
allow any string that can be converted into a `string_view` to support lazy
evaluation (so long as it also supports construction from the lazy
evaluation results).

--
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/02b24302-a207-461b-bbfc-75c9d5dcf25e%40isocpp.org.

------=_Part_1152_1600780456.1483464617772
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tuesday, January 3, 2017 at 12:15:07 PM UTC-5, lnal...@=
gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"lt=
r">Hello,<div><br></div><div>Perhaps some information here=C2=A0</div><div>=
<a href=3D"https://groups.google.com/a/isocpp.org/forum/?utm_medium=3Demail=
&amp;utm_source=3Dfooter#!topic/std-proposals/1RcShRhrmRc" target=3D"_blank=
" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.co=
m/a/isocpp.org/forum/?utm_medium\x3demail\x26utm_source\x3dfooter#!topic/st=
d-proposals/1RcShRhrmRc&#39;;return true;" onclick=3D"this.href=3D&#39;http=
s://groups.google.com/a/isocpp.org/forum/?utm_medium\x3demail\x26utm_source=
\x3dfooter#!topic/std-proposals/1RcShRhrmRc&#39;;return true;">https://grou=
ps.google.com/a/<wbr>isocpp.org/forum/?utm_medium=3D<wbr>email&amp;utm_sour=
ce=3Dfooter#!<wbr>topic/std-proposals/<wbr>1RcShRhrmRc</a></div></div></blo=
ckquote><div><br>That post gives a good reason for why not to have such an =
overload: to eventually support lazy evaluation. If you implement non-lazy =
operations now, then they will be non-lazy... forever.<br><br>That being sa=
id, you could still provoke non-lazy evaluation in cases where you&#39;re o=
nly combining `string_view`. So if you want lazy-evaluation, you would cons=
truct a `string_view` from the `std::string`. This would also allow any str=
ing that can be converted into a `string_view` to support lazy evaluation (=
so long as it also supports construction from the lazy evaluation results).=
<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/02b24302-a207-461b-bbfc-75c9d5dcf25e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/02b24302-a207-461b-bbfc-75c9d5dcf25e=
%40isocpp.org</a>.<br />

------=_Part_1152_1600780456.1483464617772--

------=_Part_1151_574821793.1483464617772--

.


Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Tue, 3 Jan 2017 18:51:44 +0100
Raw View
2017-01-03 18:30 GMT+01:00 Nicol Bolas <jmckesson@gmail.com>:
> On Tuesday, January 3, 2017 at 12:15:07 PM UTC-5, lnal...@gmail.com wrote:
>>
>> Hello,
>>
>> Perhaps some information here
>>
>> https://groups.google.com/a/isocpp.org/forum/?utm_medium=email&utm_source=footer#!topic/std-proposals/1RcShRhrmRc
>
>
> That post gives a good reason for why not to have such an overload: to
> eventually support lazy evaluation. If you implement non-lazy operations
> now, then they will be non-lazy... forever.
>
> That being said, you could still provoke non-lazy evaluation in cases where
> you're only combining `string_view`. So if you want lazy-evaluation, you
> would construct a `string_view` from the `std::string`. This would also
> allow any string that can be converted into a `string_view` to support lazy
> evaluation (so long as it also supports construction from the lazy
> evaluation results).

Luckily the operators can be defined by the user but it's still an
annoying gap in the current standard.



--
Olaf

--
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/CAA7U3HMAHfwUP848bJonrfLAB1vdnUuZGkOx5yCepAgHWo-AbQ%40mail.gmail.com.

.


Author: Jakob Riedle <jakob.riedle@gmail.com>
Date: Sat, 29 Apr 2017 15:38:11 -0700 (PDT)
Raw View
------=_Part_1411_103883419.1493505491297
Content-Type: multipart/alternative;
 boundary="----=_Part_1412_1351631340.1493505491297"

------=_Part_1412_1351631340.1493505491297
Content-Type: text/plain; charset=UTF-8


>
> If you implement non-lazy operations now, then they will be non-lazy...
> forever.
>

Has there been any proposal that adds lazy evaluation to string
concatenations?

--
Jakob

--
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/f5c2124b-6134-4547-965a-321d8db0c280%40isocpp.org.

------=_Part_1412_1351631340.1493505491297
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">=
If you implement non-lazy operations now, then they will be non-lazy... for=
ever.<br></blockquote><div><br></div><div>Has there been any proposal that =
adds lazy evaluation to string concatenations?</div><div><br></div><div>--<=
/div><div>Jakob</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/f5c2124b-6134-4547-965a-321d8db0c280%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f5c2124b-6134-4547-965a-321d8db0c280=
%40isocpp.org</a>.<br />

------=_Part_1412_1351631340.1493505491297--

------=_Part_1411_103883419.1493505491297--

.


Author: olaf@join.cc
Date: Wed, 24 May 2017 02:19:08 -0700 (PDT)
Raw View
------=_Part_3998_1832590703.1495617548159
Content-Type: multipart/alternative;
 boundary="----=_Part_3999_427276643.1495617548159"

------=_Part_3999_427276643.1495617548159
Content-Type: text/plain; charset="UTF-8"

Op zondag 30 april 2017 00:38:11 UTC+2 schreef Jakob Riedle:
>
> If you implement non-lazy operations now, then they will be non-lazy...
>> forever.
>>
>
> Has there been any proposal that adds lazy evaluation to string
> concatenations?
>

I don't think so.

--
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/b5b1b4a6-23fa-402c-8c2e-c36ada170d6b%40isocpp.org.

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

<div dir=3D"ltr">Op zondag 30 april 2017 00:38:11 UTC+2 schreef Jakob Riedl=
e:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;b=
order-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><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">If you implement non-lazy operations=
 now, then they will be non-lazy... forever.<br></blockquote><div><br></div=
><div>Has there been any proposal that adds lazy evaluation to string conca=
tenations?</div></div></blockquote><div><br></div><div>I don&#39;t think so=
..=C2=A0</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/b5b1b4a6-23fa-402c-8c2e-c36ada170d6b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b5b1b4a6-23fa-402c-8c2e-c36ada170d6b=
%40isocpp.org</a>.<br />

------=_Part_3999_427276643.1495617548159--

------=_Part_3998_1832590703.1495617548159--

.