Topic: operator<< for std::string


Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Mon, 20 Feb 2017 07:55:03 -0800 (PST)
Raw View
------=_Part_1018_2023495734.1487606103724
Content-Type: multipart/alternative;
 boundary="----=_Part_1019_2019639607.1487606103724"

------=_Part_1019_2019639607.1487606103724
Content-Type: text/plain; charset=UTF-8

Hi,

One frequently needs to append stuff to strings, but the standard way (s +=
"A" + "B" + to_string(42)) isn't optimal due to temporaries. Operator<< for
std::string seems like the obvious solution. It could support string_view,
integers, maybe floats but without formatting options.. It's trivially
extensible.

s << "A" << "B" << 42;

Would this be useful for the C++ std lib?

--
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/7552b5b4-e778-46a2-a6f8-fabca5b16dc4%40isocpp.org.

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

<div dir=3D"ltr"><span style=3D"font-family: arial, sans-serif; font-size: =
12.8px;">Hi,</span><br style=3D"font-family: arial, sans-serif; font-size: =
12.8px;"><br style=3D"font-family: arial, sans-serif; font-size: 12.8px;"><=
span style=3D"font-family: arial, sans-serif; font-size: 12.8px;">One frequ=
ently needs to append stuff to strings, but the standard way=C2=A0</span><s=
pan style=3D"font-family: arial, sans-serif; font-size: 12.8px;">(s +=3D &q=
uot;A&quot; + &quot;B&quot; + to_string(42)) isn&#39;t optimal due to tempo=
raries.=C2=A0</span><span style=3D"font-family: arial, sans-serif; font-siz=
e: 12.8px;">Operator&lt;&lt; for std::string seems like the obvious solutio=
n.=C2=A0</span><span style=3D"font-family: arial, sans-serif; font-size: 12=
..8px;">It could support string_view, integers, maybe floats=C2=A0</span><sp=
an style=3D"font-family: arial, sans-serif; font-size: 12.8px;">but without=
 formatting options..=C2=A0</span><font face=3D"arial, sans-serif"><span st=
yle=3D"font-size: 12.8px;">It&#39;s trivially extensible.</span></font><br =
style=3D"font-family: arial, sans-serif; font-size: 12.8px;"><br style=3D"f=
ont-family: arial, sans-serif; font-size: 12.8px;"><span style=3D"font-fami=
ly: arial, sans-serif; font-size: 12.8px;">s &lt;&lt; &quot;A&quot; &lt;&lt=
; &quot;B&quot; &lt;&lt; 42;</span><br style=3D"font-family: arial, sans-se=
rif; font-size: 12.8px;"><br style=3D"font-family: arial, sans-serif; font-=
size: 12.8px;"><span style=3D"font-family: arial, sans-serif; font-size: 12=
..8px;">Would this be useful for the C++ std lib?</span><br><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/7552b5b4-e778-46a2-a6f8-fabca5b16dc4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7552b5b4-e778-46a2-a6f8-fabca5b16dc4=
%40isocpp.org</a>.<br />

------=_Part_1019_2019639607.1487606103724--

------=_Part_1018_2023495734.1487606103724--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 20 Feb 2017 08:17:24 -0800 (PST)
Raw View
------=_Part_5841_1056148906.1487607444632
Content-Type: multipart/alternative;
 boundary="----=_Part_5842_215375944.1487607444632"

------=_Part_5842_215375944.1487607444632
Content-Type: text/plain; charset=UTF-8



On Monday, February 20, 2017 at 10:55:03 AM UTC-5, Olaf van der Spek wrote:
>
> Hi,
>
> One frequently needs to append stuff to strings, but the standard way (s
> += "A" + "B" + to_string(42)) isn't optimal due to temporaries. Operator<<
> for std::string seems like the obvious solution. It could support
> string_view, integers, maybe floats but without formatting options.. It's
> trivially extensible.
>
> s << "A" << "B" << 42;
>
> Would this be useful for the C++ std lib?
>

Or we can just implement P0408 (PDF) <http://wg21.link/P0408> and do it
this way:

std::ostringstream builder;
builder << "A" << "B" << 42;
s += builder.piler();

This way, you get all of the power of iostreams (though also all of the
performance of iostreams), so we don't have to quibble about formatting and
so forth.

--
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/75e1c827-a2af-4dfa-9426-dc5a00a0d408%40isocpp.org.

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

<div dir=3D"ltr"><br><br>On Monday, February 20, 2017 at 10:55:03 AM UTC-5,=
 Olaf van der Spek 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"ltr"><span style=3D"font-family:arial,sans-serif;font-size:12.8px">H=
i,</span><br style=3D"font-family:arial,sans-serif;font-size:12.8px"><br st=
yle=3D"font-family:arial,sans-serif;font-size:12.8px"><span style=3D"font-f=
amily:arial,sans-serif;font-size:12.8px">One frequently needs to append stu=
ff to strings, but the standard way=C2=A0</span><span style=3D"font-family:=
arial,sans-serif;font-size:12.8px">(s +=3D &quot;A&quot; + &quot;B&quot; + =
to_string(42)) isn&#39;t optimal due to temporaries.=C2=A0</span><span styl=
e=3D"font-family:arial,sans-serif;font-size:12.8px">Operator&lt;&lt; for st=
d::string seems like the obvious solution.=C2=A0</span><span style=3D"font-=
family:arial,sans-serif;font-size:12.8px">It could support string_view, int=
egers, maybe floats=C2=A0</span><span style=3D"font-family:arial,sans-serif=
;font-size:12.8px">but without formatting options..=C2=A0</span><font face=
=3D"arial, sans-serif"><span style=3D"font-size:12.8px">It&#39;s trivially =
extensible.</span></font><br style=3D"font-family:arial,sans-serif;font-siz=
e:12.8px"><br style=3D"font-family:arial,sans-serif;font-size:12.8px"><span=
 style=3D"font-family:arial,sans-serif;font-size:12.8px">s &lt;&lt; &quot;A=
&quot; &lt;&lt; &quot;B&quot; &lt;&lt; 42;</span><br style=3D"font-family:a=
rial,sans-serif;font-size:12.8px"><br style=3D"font-family:arial,sans-serif=
;font-size:12.8px"><span style=3D"font-family:arial,sans-serif;font-size:12=
..8px">Would this be useful for the C++ std lib?</span></div></blockquote><d=
iv><br>Or we can just implement <a href=3D"http://wg21.link/P0408">P0408 (P=
DF)</a> and do it this way:<br><br><div style=3D"background-color: rgb(250,=
 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-w=
idth: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D=
"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">ostringstream builder</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>builder </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pret=
tify">&quot;A&quot;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;B&quo=
t;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">42</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>s </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">+=3D</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> builder</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">piler</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">();</span></div></code></div><br>This way, you get all of the power of =
iostreams (though also all of the performance of iostreams), so we don&#39;=
t have to quibble about formatting and so forth.<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/75e1c827-a2af-4dfa-9426-dc5a00a0d408%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/75e1c827-a2af-4dfa-9426-dc5a00a0d408=
%40isocpp.org</a>.<br />

------=_Part_5842_215375944.1487607444632--

------=_Part_5841_1056148906.1487607444632--

.


Author: HarD Gamer <rodrigojose690@gmail.com>
Date: Mon, 20 Feb 2017 08:42:45 -0800 (PST)
Raw View
------=_Part_1000_1122804971.1487608965677
Content-Type: multipart/alternative;
 boundary="----=_Part_1001_462247335.1487608965677"

------=_Part_1001_462247335.1487608965677
Content-Type: text/plain; charset=UTF-8



I think make ostringstream better is the solution

<https://lh3.googleusercontent.com/-tU9r3aNuWqM/WKscejsoQgI/AAAAAAAAATE/QhjaIZ75OT0IOeYdWDocDul-txdclboZgCLcB/s1600/ostrstr.png>


Em segunda-feira, 20 de fevereiro de 2017 12:55:03 UTC-3, Olaf van der Spek
escreveu:
>
> Hi,
>
> One frequently needs to append stuff to strings, but the standard way (s
> += "A" + "B" + to_string(42)) isn't optimal due to temporaries. Operator<<
> for std::string seems like the obvious solution. It could support
> string_view, integers, maybe floats but without formatting options.. It's
> trivially extensible.
>
> s << "A" << "B" << 42;
>
> Would this be useful for the C++ std lib?
>
>

--
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/bf963a02-a82d-4c0b-b0e7-1bddc9f0e6cc%40isocpp.org.

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

<div dir=3D"ltr"><p class=3D"separator" style=3D"text-align: center; clear:=
 both;">I think make ostringstream better is the solution</p><p class=3D"se=
parator" style=3D"text-align: center; clear: both;"><a imageanchor=3D"1" hr=
ef=3D"https://lh3.googleusercontent.com/-tU9r3aNuWqM/WKscejsoQgI/AAAAAAAAAT=
E/QhjaIZ75OT0IOeYdWDocDul-txdclboZgCLcB/s1600/ostrstr.png" style=3D"margin-=
left: 1em; margin-right: 1em;"><img src=3D"https://lh3.googleusercontent.co=
m/-tU9r3aNuWqM/WKscejsoQgI/AAAAAAAAATE/QhjaIZ75OT0IOeYdWDocDul-txdclboZgCLc=
B/s320/ostrstr.png" border=3D"0" style=3D"" width=3D"320" height=3D"144"></=
a></p>=C2=A0<br><br>Em segunda-feira, 20 de fevereiro de 2017 12:55:03 UTC-=
3, Olaf van der Spek  escreveu:<blockquote class=3D"gmail_quote" style=3D"m=
argin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"=
><div dir=3D"ltr"><span style=3D"font-family:arial,sans-serif;font-size:12.=
8px">Hi,</span><br style=3D"font-family:arial,sans-serif;font-size:12.8px">=
<br style=3D"font-family:arial,sans-serif;font-size:12.8px"><span style=3D"=
font-family:arial,sans-serif;font-size:12.8px">One frequently needs to appe=
nd stuff to strings, but the standard way=C2=A0</span><span style=3D"font-f=
amily:arial,sans-serif;font-size:12.8px">(s +=3D &quot;A&quot; + &quot;B&qu=
ot; + to_string(42)) isn&#39;t optimal due to temporaries.=C2=A0</span><spa=
n style=3D"font-family:arial,sans-serif;font-size:12.8px">Operator&lt;&lt; =
for std::string seems like the obvious solution.=C2=A0</span><span style=3D=
"font-family:arial,sans-serif;font-size:12.8px">It could support string_vie=
w, integers, maybe floats=C2=A0</span><span style=3D"font-family:arial,sans=
-serif;font-size:12.8px">but without formatting options..=C2=A0</span><font=
 face=3D"arial, sans-serif"><span style=3D"font-size:12.8px">It&#39;s trivi=
ally extensible.</span></font><br style=3D"font-family:arial,sans-serif;fon=
t-size:12.8px"><br style=3D"font-family:arial,sans-serif;font-size:12.8px">=
<span style=3D"font-family:arial,sans-serif;font-size:12.8px">s &lt;&lt; &q=
uot;A&quot; &lt;&lt; &quot;B&quot; &lt;&lt; 42;</span><br style=3D"font-fam=
ily:arial,sans-serif;font-size:12.8px"><br style=3D"font-family:arial,sans-=
serif;font-size:12.8px"><span style=3D"font-family:arial,sans-serif;font-si=
ze:12.8px">Would this be useful for the C++ std lib?</span><br><div><br></d=
iv></div></blockquote></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/bf963a02-a82d-4c0b-b0e7-1bddc9f0e6cc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/bf963a02-a82d-4c0b-b0e7-1bddc9f0e6cc=
%40isocpp.org</a>.<br />

------=_Part_1001_462247335.1487608965677--

------=_Part_1000_1122804971.1487608965677--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Mon, 20 Feb 2017 22:31:32 -0800 (PST)
Raw View
------=_Part_1179_1241934462.1487658692994
Content-Type: multipart/alternative;
 boundary="----=_Part_1180_1478324794.1487658692994"

------=_Part_1180_1478324794.1487658692994
Content-Type: text/plain; charset=UTF-8

Streams are NOT alternative to std::string! By many reasons.

--
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/c1f7a833-a8fa-48d7-96c2-1ffe8ae292fc%40isocpp.org.

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

<div dir=3D"ltr">Streams are NOT alternative to std::string! By many reason=
s.<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/c1f7a833-a8fa-48d7-96c2-1ffe8ae292fc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c1f7a833-a8fa-48d7-96c2-1ffe8ae292fc=
%40isocpp.org</a>.<br />

------=_Part_1180_1478324794.1487658692994--

------=_Part_1179_1241934462.1487658692994--

.


Author: =?UTF-8?Q?Jonathan_M=c3=bcller?= <jonathanmueller.dev@gmail.com>
Date: Tue, 21 Feb 2017 08:50:42 +0100
Raw View
On 21.02.2017 07:31, Victor Dyachenko wrote:
> Streams are NOT alternative to std::string! By many reasons.

What about something like fmt (https://github.com/fmtlib/fmt)?
The author is working on a proposal for the standard library.


--
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/13e7b62b-2b0f-4feb-f84a-f3e2a722bb33%40gmail.com.

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 21 Feb 2017 07:31:01 -0800 (PST)
Raw View
------=_Part_6398_1608148557.1487691061604
Content-Type: multipart/alternative;
 boundary="----=_Part_6399_1584014477.1487691061604"

------=_Part_6399_1584014477.1487691061604
Content-Type: text/plain; charset=UTF-8

On Tuesday, February 21, 2017 at 1:31:33 AM UTC-5, Victor Dyachenko wrote:
>
> Streams are NOT alternative to std::string! By many reasons.
>

Can you list some of them? Because many languages' standard libraries have
a distinction between the every-day string type and "string builder" types.
Java <http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html>
and C#
<https://msdn.microsoft.com/en-us/library/system.text.stringbuilder(v=vs.110).aspx>
being prominent examples.

The only problem with C++'s stringstream is the cost of moving strings
into/outof them. And that proposal would remove that cost.

--
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/85aefeb5-3c83-47de-a91d-3aef22d6a1ec%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, February 21, 2017 at 1:31:33 AM UTC-5, Victor =
Dyachenko 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">Streams are NOT alternative to std::string! By many reasons.<br></div></=
blockquote><div><br>Can you list some of them? Because many languages&#39; =
standard libraries have a distinction between the every-day string type and=
 &quot;string builder&quot; types. <a href=3D"http://docs.oracle.com/javase=
/7/docs/api/java/lang/StringBuilder.html">Java</a> and <a href=3D"https://m=
sdn.microsoft.com/en-us/library/system.text.stringbuilder(v=3Dvs.110).aspx"=
>C#</a> being prominent examples.<br><br>The only problem with C++&#39;s st=
ringstream is the cost of moving strings into/outof them. And that proposal=
 would remove that cost.<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/85aefeb5-3c83-47de-a91d-3aef22d6a1ec%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/85aefeb5-3c83-47de-a91d-3aef22d6a1ec=
%40isocpp.org</a>.<br />

------=_Part_6399_1584014477.1487691061604--

------=_Part_6398_1608148557.1487691061604--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Tue, 21 Feb 2017 07:39:30 -0800 (PST)
Raw View
------=_Part_1357_233963480.1487691571025
Content-Type: multipart/alternative;
 boundary="----=_Part_1358_1709224383.1487691571026"

------=_Part_1358_1709224383.1487691571026
Content-Type: text/plain; charset=UTF-8

On Tuesday, February 21, 2017 at 6:31:01 PM UTC+3, Nicol Bolas wrote:
>
> On Tuesday, February 21, 2017 at 1:31:33 AM UTC-5, Victor Dyachenko wrote:
>>
>> Streams are NOT alternative to std::string! By many reasons.
>>
>
> Can you list some of them? Because many languages' standard libraries have
> a distinction between the every-day string type and "string builder" types.
> Java
> <http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html>
> and C#
> <https://msdn.microsoft.com/en-us/library/system.text.stringbuilder(v=vs.110).aspx>
> being prominent examples.
>
> The only problem with C++'s stringstream is the cost of moving strings
> into/outof them. And that proposal would remove that cost.
>

Top two:

1) Streams are slow (overcomplicated design, virtual calls, locales, too
generic)
2) Streams are huge - statically linked "hello world" is more than 1Mb
(again mostly because of locales)

--
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/5f77cec0-c0b3-4993-9c3e-318c7e985f7f%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, February 21, 2017 at 6:31:01 PM UTC+3, Nicol B=
olas 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"ltr">On=
 Tuesday, February 21, 2017 at 1:31:33 AM UTC-5, Victor Dyachenko wrote:<bl=
ockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Streams are NOT alter=
native to std::string! By many reasons.<br></div></blockquote><div><br>Can =
you list some of them? Because many languages&#39; standard libraries have =
a distinction between the every-day string type and &quot;string builder&qu=
ot; types. <a href=3D"http://docs.oracle.com/javase/7/docs/api/java/lang/St=
ringBuilder.html" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.hr=
ef=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdocs.oracle.com%2Fjav=
ase%2F7%2Fdocs%2Fapi%2Fjava%2Flang%2FStringBuilder.html\x26sa\x3dD\x26sntz\=
x3d1\x26usg\x3dAFQjCNELDcP1ubLPKRXC1xz7Uk3NlrvK7A&#39;;return true;" onclic=
k=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdocs.orac=
le.com%2Fjavase%2F7%2Fdocs%2Fapi%2Fjava%2Flang%2FStringBuilder.html\x26sa\x=
3dD\x26sntz\x3d1\x26usg\x3dAFQjCNELDcP1ubLPKRXC1xz7Uk3NlrvK7A&#39;;return t=
rue;">Java</a> and <a href=3D"https://msdn.microsoft.com/en-us/library/syst=
em.text.stringbuilder(v=3Dvs.110).aspx" target=3D"_blank" rel=3D"nofollow" =
onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F=
%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fsystem.text.stringbuilder(v%3Dvs.=
110).aspx\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHaVnEaqQ-DNPDwn3rpnAkLCCt=
OzQ&#39;;return true;" onclick=3D"this.href=3D&#39;https://www.google.com/u=
rl?q\x3dhttps%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fsystem.text.st=
ringbuilder(v%3Dvs.110).aspx\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHaVnEa=
qQ-DNPDwn3rpnAkLCCtOzQ&#39;;return true;">C#</a> being prominent examples.<=
br><br>The only problem with C++&#39;s stringstream is the cost of moving s=
trings into/outof them. And that proposal would remove that cost.<br></div>=
</div></blockquote><div><br>Top two:<br><br>1) Streams are slow (overcompli=
cated design, virtual calls, locales, too generic)<br>2) Streams are huge -=
 statically linked &quot;hello world&quot; is more than 1Mb (again mostly b=
ecause of locales)</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/5f77cec0-c0b3-4993-9c3e-318c7e985f7f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5f77cec0-c0b3-4993-9c3e-318c7e985f7f=
%40isocpp.org</a>.<br />

------=_Part_1358_1709224383.1487691571026--

------=_Part_1357_233963480.1487691571025--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Tue, 21 Feb 2017 07:42:58 -0800 (PST)
Raw View
------=_Part_1439_932595324.1487691778884
Content-Type: multipart/alternative;
 boundary="----=_Part_1440_1786502454.1487691778885"

------=_Part_1440_1786502454.1487691778885
Content-Type: text/plain; charset=UTF-8

On Tuesday, February 21, 2017 at 6:39:31 PM UTC+3, Victor Dyachenko wrote:
>
> On Tuesday, February 21, 2017 at 6:31:01 PM UTC+3, Nicol Bolas wrote:
>>
>> On Tuesday, February 21, 2017 at 1:31:33 AM UTC-5, Victor Dyachenko wrote:
>>>
>>> Streams are NOT alternative to std::string! By many reasons.
>>>
>>
>> Can you list some of them? Because many languages' standard libraries
>> have a distinction between the every-day string type and "string builder"
>> types. Java
>> <http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html>
>> and C#
>> <https://msdn.microsoft.com/en-us/library/system.text.stringbuilder(v=vs.110).aspx>
>> being prominent examples.
>>
>> The only problem with C++'s stringstream is the cost of moving strings
>> into/outof them. And that proposal would remove that cost.
>>
>
> Top two:
>
> 1) Streams are slow (overcomplicated design, virtual calls, locales, too
> generic)
> 2) Streams are huge - statically linked "hello world" is more than 1Mb
> (again mostly because of locales)
>

And that's why now we have std::to_chars/from_chars()

--
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/c65781eb-0611-40f0-9517-74e4b505a26d%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, February 21, 2017 at 6:39:31 PM UTC+3, Victor =
Dyachenko 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">On Tuesday, February 21, 2017 at 6:31:01 PM UTC+3, Nicol Bolas wrote:<bl=
ockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Tuesday, February =
21, 2017 at 1:31:33 AM UTC-5, Victor Dyachenko wrote:<blockquote class=3D"g=
mail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;=
padding-left:1ex"><div dir=3D"ltr">Streams are NOT alternative to std::stri=
ng! By many reasons.<br></div></blockquote><div><br>Can you list some of th=
em? Because many languages&#39; standard libraries have a distinction betwe=
en the every-day string type and &quot;string builder&quot; types. <a href=
=3D"http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html" =
rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D&#39;http://w=
ww.google.com/url?q\x3dhttp%3A%2F%2Fdocs.oracle.com%2Fjavase%2F7%2Fdocs%2Fa=
pi%2Fjava%2Flang%2FStringBuilder.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQ=
jCNELDcP1ubLPKRXC1xz7Uk3NlrvK7A&#39;;return true;" onclick=3D"this.href=3D&=
#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdocs.oracle.com%2Fjavase%2F=
7%2Fdocs%2Fapi%2Fjava%2Flang%2FStringBuilder.html\x26sa\x3dD\x26sntz\x3d1\x=
26usg\x3dAFQjCNELDcP1ubLPKRXC1xz7Uk3NlrvK7A&#39;;return true;">Java</a> and=
 <a href=3D"https://msdn.microsoft.com/en-us/library/system.text.stringbuil=
der(v=3Dvs.110).aspx" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"thi=
s.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmsdn.microsoft.=
com%2Fen-us%2Flibrary%2Fsystem.text.stringbuilder(v%3Dvs.110).aspx\x26sa\x3=
dD\x26sntz\x3d1\x26usg\x3dAFQjCNHaVnEaqQ-DNPDwn3rpnAkLCCtOzQ&#39;;return tr=
ue;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2=
F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fsystem.text.stringbuilder(v%3Dvs=
..110).aspx\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHaVnEaqQ-DNPDwn3rpnAkLCC=
tOzQ&#39;;return true;">C#</a> being prominent examples.<br><br>The only pr=
oblem with C++&#39;s stringstream is the cost of moving strings into/outof =
them. And that proposal would remove that cost.<br></div></div></blockquote=
><div><br>Top two:<br><br>1) Streams are slow (overcomplicated design, virt=
ual calls, locales, too generic)<br>2) Streams are huge - statically linked=
 &quot;hello world&quot; is more than 1Mb (again mostly because of locales)=
</div></div></blockquote><div><br>And that&#39;s why now we have std::to_ch=
ars/from_chars() <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/c65781eb-0611-40f0-9517-74e4b505a26d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c65781eb-0611-40f0-9517-74e4b505a26d=
%40isocpp.org</a>.<br />

------=_Part_1440_1786502454.1487691778885--

------=_Part_1439_932595324.1487691778884--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 21 Feb 2017 08:21:57 -0800 (PST)
Raw View
------=_Part_1510_1492227822.1487694117459
Content-Type: multipart/alternative;
 boundary="----=_Part_1511_1684809817.1487694117459"

------=_Part_1511_1684809817.1487694117459
Content-Type: text/plain; charset=UTF-8

On Tuesday, February 21, 2017 at 10:39:31 AM UTC-5, Victor Dyachenko wrote:
>
> On Tuesday, February 21, 2017 at 6:31:01 PM UTC+3, Nicol Bolas wrote:
>>
>> On Tuesday, February 21, 2017 at 1:31:33 AM UTC-5, Victor Dyachenko wrote:
>>>
>>> Streams are NOT alternative to std::string! By many reasons.
>>>
>>
>> Can you list some of them? Because many languages' standard libraries
>> have a distinction between the every-day string type and "string builder"
>> types. Java
>> <http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html>
>> and C#
>> <https://msdn.microsoft.com/en-us/library/system.text.stringbuilder(v=vs.110).aspx>
>> being prominent examples.
>>
>> The only problem with C++'s stringstream is the cost of moving strings
>> into/outof them. And that proposal would remove that cost.
>>
>
> Top two:
>
> 1) Streams are slow (overcomplicated design, virtual calls, locales, too
> generic)
> 2) Streams are huge - statically linked "hello world" is more than 1Mb
> (again mostly because of locales)
>

What compiler/framework are you using that gives you a 1MB Hello World? I
have plenty of *debug* builds of small programs that use iostreams that
don't even crack 100KB. Release builds of such tools barely break 20KB.

Really, there's no need to *invent* flaws in iostreams; it has enough
legitimate ones as is ;)

Is iostreams slower than it needs to be? Sure, but that's not the question.
To me, the question is: is stringstream sufficiently slower *for this
application* (building strings, with *formatting*) that we *need* an
alternative?

On Tuesday, February 21, 2017 at 10:42:59 AM UTC-5, Victor Dyachenko wrote:

> And that's why now we have std::to_chars/from_chars()


`to/from_chars` is not just about performance.

They allow one to avoid using standard library types. And one can certainly
say that this is about performance; after all, if performance didn't
matter, you could just copy to/from `std::string` as needed by `to_string`
and `stoi/f`. But it's *also* about allowing people who work in domains
where they simply *cannot* dynamically allocate memory to be able to
function. It's not that allocation would be slow; it's that it simply is
not allowed. So while that matters for performance, it's not *just* about
performance.

Also, it's important to remember that `to/from_chars` represents a
*superset* of the functionality of `stoi/f` and `to_string`. Despite being
lower-level, it gives you more formatting power than those functions. It
also provides round-trip guarantees that the other functions do not. And
even compared to iostream `<<`, `to/from_chars` provides almost all of the
formatting capabilities of that tool.

By contrast, the OP's suggestion doesn't provide nearly as much
functionality as the iostream equivalent.

So there's a big difference between `to/from_chars` and this suggestion.

I do not *like* iostreams. I'd rather we have something better and faster.
But stringstream solves the problem that the OP wants solved quite
adequately. The principle performance problem that stringstream has is the
additional copy after formatting. Get rid of that, and most of the
performance difference goes away.

--
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/cc23a9d4-db7d-40d7-b462-bba1ce306b12%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, February 21, 2017 at 10:39:31 AM UTC-5, Victor=
 Dyachenko wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr">On Tuesday, February 21, 2017 at 6:31:01 PM UTC+3, Nicol Bolas wrote:<b=
lockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-=
left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Tuesday, February=
 21, 2017 at 1:31:33 AM UTC-5, Victor Dyachenko 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"ltr">Streams are NOT alternative to std::str=
ing! By many reasons.<br></div></blockquote><div><br>Can you list some of t=
hem? Because many languages&#39; standard libraries have a distinction betw=
een the every-day string type and &quot;string builder&quot; types. <a href=
=3D"http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html" =
rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D&#39;http://w=
ww.google.com/url?q\x3dhttp%3A%2F%2Fdocs.oracle.com%2Fjavase%2F7%2Fdocs%2Fa=
pi%2Fjava%2Flang%2FStringBuilder.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQ=
jCNELDcP1ubLPKRXC1xz7Uk3NlrvK7A&#39;;return true;" onclick=3D"this.href=3D&=
#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdocs.oracle.com%2Fjavase%2F=
7%2Fdocs%2Fapi%2Fjava%2Flang%2FStringBuilder.html\x26sa\x3dD\x26sntz\x3d1\x=
26usg\x3dAFQjCNELDcP1ubLPKRXC1xz7Uk3NlrvK7A&#39;;return true;">Java</a> and=
 <a href=3D"https://msdn.microsoft.com/en-us/library/system.text.stringbuil=
der(v=3Dvs.110).aspx" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"thi=
s.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmsdn.microsoft.=
com%2Fen-us%2Flibrary%2Fsystem.text.stringbuilder(v%3Dvs.110).aspx\x26sa\x3=
dD\x26sntz\x3d1\x26usg\x3dAFQjCNHaVnEaqQ-DNPDwn3rpnAkLCCtOzQ&#39;;return tr=
ue;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2=
F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fsystem.text.stringbuilder(v%3Dvs=
..110).aspx\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHaVnEaqQ-DNPDwn3rpnAkLCC=
tOzQ&#39;;return true;">C#</a> being prominent examples.<br><br>The only pr=
oblem with C++&#39;s stringstream is the cost of moving strings into/outof =
them. And that proposal would remove that cost.<br></div></div></blockquote=
><div><br>Top two:<br><br>1) Streams are slow (overcomplicated design, virt=
ual calls, locales, too generic)<br>2) Streams are huge - statically linked=
 &quot;hello world&quot; is more than 1Mb (again mostly because of locales)=
</div></div></blockquote><div><br>What compiler/framework are you using tha=
t gives you a 1MB Hello World? I have plenty of <i>debug</i> builds of smal=
l programs that use iostreams that don&#39;t even crack 100KB. Release buil=
ds of such tools barely break 20KB.<br><br>Really, there&#39;s no need to <=
i>invent</i> flaws in iostreams; it has enough legitimate ones as is ;)<br>=
<br>Is iostreams slower than it needs to be? Sure, but that&#39;s not the q=
uestion. To me, the question is: is stringstream sufficiently slower <i>for=
 this application</i> (building strings, with <i>formatting</i>) that we <i=
>need</i> an alternative?<br><br>On Tuesday, February 21, 2017 at 10:42:59 =
AM UTC-5, Victor Dyachenko wrote:<br><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); =
padding-left: 1ex;">And that&#39;s why now we have std::to_chars/from_chars=
() </blockquote><div><br>`to/from_chars` is not just about performance.<br>=
<br>They allow one to avoid using standard library types. And one can certa=
inly say that this is about performance; after all, if performance didn&#39=
;t matter, you could just copy to/from `std::string` as needed by `to_strin=
g` and `stoi/f`. But it&#39;s <i>also</i> about allowing people who work in=
 domains where they simply <i>cannot</i> dynamically allocate memory to be =
able to function. It&#39;s not that allocation would be slow; it&#39;s that=
 it simply is not allowed. So while that matters for performance, it&#39;s =
not <i>just</i> about performance.<br><br>Also, it&#39;s important to remem=
ber that `to/from_chars` represents a <i>superset</i> of the functionality =
of `stoi/f` and `to_string`. Despite being lower-level, it gives you more f=
ormatting power than those functions. It also provides round-trip guarantee=
s that the other functions do not. And even compared to iostream `&lt;&lt;`=
, `to/from_chars` provides almost all of the formatting capabilities of tha=
t tool.<br><br>By contrast, the OP&#39;s suggestion doesn&#39;t provide nea=
rly as much functionality as the iostream equivalent.<br><br>So there&#39;s=
 a big difference between `to/from_chars` and this suggestion.<br><br>I do =
not <i>like</i> iostreams. I&#39;d rather we have something better and fast=
er. But stringstream solves the problem that the OP wants solved quite adeq=
uately. The principle performance problem that stringstream has is the addi=
tional copy after formatting. Get rid of that, and most of the performance =
difference goes away.<br></div></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/cc23a9d4-db7d-40d7-b462-bba1ce306b12%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cc23a9d4-db7d-40d7-b462-bba1ce306b12=
%40isocpp.org</a>.<br />

------=_Part_1511_1684809817.1487694117459--

------=_Part_1510_1492227822.1487694117459--

.


Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Tue, 21 Feb 2017 09:11:13 -0800 (PST)
Raw View
------=_Part_1461_1294403352.1487697073697
Content-Type: multipart/alternative;
 boundary="----=_Part_1462_396766727.1487697073697"

------=_Part_1462_396766727.1487697073697
Content-Type: text/plain; charset=UTF-8



Op dinsdag 21 februari 2017 17:21:57 UTC+1 schreef Nicol Bolas:
>
> I do not *like* iostreams. I'd rather we have something better and
> faster. But stringstream solves the problem that the OP wants solved quite
> adequately.
>

Performance matters.
Syntax matters.

pilfer() is nice but I don't think it solves everything.


> The principle performance problem that stringstream has is the additional
> copy after formatting. Get rid of that, and most of the performance
> difference goes away.
>

What happened to performance issues related to locales and virtual calls?



--
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/46ec3307-ecfe-493c-b260-f2a39578d5ba%40isocpp.org.

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

<div dir=3D"ltr"><br><br>Op dinsdag 21 februari 2017 17:21:57 UTC+1 schreef=
 Nicol Bolas:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
<div><div>I do not <i>like</i> iostreams. I&#39;d rather we have something =
better and faster. But stringstream solves the problem that the OP wants so=
lved quite adequately. </div></div></div></blockquote><div><br></div><div>P=
erformance matters.</div><div>Syntax matters.</div><div><br></div><div>pilf=
er() is nice but I don&#39;t think it solves everything.</div><div>=C2=A0=
=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><=
div><div>The principle performance problem that stringstream has is the add=
itional copy after formatting. Get rid of that, and most of the performance=
 difference goes away.<br></div></div></div></blockquote><div><br></div><di=
v>What happened to performance issues related to locales and virtual calls?=
</div><div><br></div><div>=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/46ec3307-ecfe-493c-b260-f2a39578d5ba%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/46ec3307-ecfe-493c-b260-f2a39578d5ba=
%40isocpp.org</a>.<br />

------=_Part_1462_396766727.1487697073697--

------=_Part_1461_1294403352.1487697073697--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Tue, 21 Feb 2017 09:25:58 -0800 (PST)
Raw View
------=_Part_1464_776468080.1487697958215
Content-Type: multipart/alternative;
 boundary="----=_Part_1465_1318979768.1487697958215"

------=_Part_1465_1318979768.1487697958215
Content-Type: text/plain; charset=UTF-8

On Tuesday, February 21, 2017 at 6:31:01 PM UTC+3, Nicol Bolas wrote:
>
> On Tuesday, February 21, 2017 at 1:31:33 AM UTC-5, Victor Dyachenko wrote:
>>
>> Streams are NOT alternative to std::string! By many reasons.
>>
>
> many languages' standard libraries have a distinction between the
> every-day string type and "string builder" types. Java
> <http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html>
> and C#
> <https://msdn.microsoft.com/en-us/library/system.text.stringbuilder(v=vs.110).aspx>
> being prominent examples.
>
> Yes, but keep in mind that std::string is not a counterpart of
java.lang.String, it is a counterpart of java.lang.StringBuilder.
java.lang.Strring is more like std::string_view.

What compiler/framework are you using that gives you a 1MB Hello World? I
> have plenty of debug builds of small programs that use iostreams that don't
> even crack 100KB. Release builds of such tools barely break 20KB.
>
I use GNU libstdc++ with gcc. Just add -static-libstdc++ -static-libgcc.

--
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/befa166e-aec2-4bc3-b619-cf2a8ee9cedb%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, February 21, 2017 at 6:31:01 PM UTC+3, Nicol B=
olas 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"ltr">On=
 Tuesday, February 21, 2017 at 1:31:33 AM UTC-5, Victor Dyachenko wrote:<bl=
ockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Streams are NOT alter=
native to std::string! By many reasons.<br></div></blockquote><div><br>many=
 languages&#39; standard libraries have a distinction between the every-day=
 string type and &quot;string builder&quot; types. <a href=3D"http://docs.o=
racle.com/javase/7/docs/api/java/lang/StringBuilder.html" target=3D"_blank"=
 rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/url=
?q\x3dhttp%3A%2F%2Fdocs.oracle.com%2Fjavase%2F7%2Fdocs%2Fapi%2Fjava%2Flang%=
2FStringBuilder.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNELDcP1ubLPKRXC=
1xz7Uk3NlrvK7A&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.go=
ogle.com/url?q\x3dhttp%3A%2F%2Fdocs.oracle.com%2Fjavase%2F7%2Fdocs%2Fapi%2F=
java%2Flang%2FStringBuilder.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL=
DcP1ubLPKRXC1xz7Uk3NlrvK7A&#39;;return true;">Java</a> and <a href=3D"https=
://msdn.microsoft.com/en-us/library/system.text.stringbuilder(v=3Dvs.110).a=
spx" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;htt=
ps://www.google.com/url?q\x3dhttps%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flib=
rary%2Fsystem.text.stringbuilder(v%3Dvs.110).aspx\x26sa\x3dD\x26sntz\x3d1\x=
26usg\x3dAFQjCNHaVnEaqQ-DNPDwn3rpnAkLCCtOzQ&#39;;return true;" onclick=3D"t=
his.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmsdn.microsof=
t.com%2Fen-us%2Flibrary%2Fsystem.text.stringbuilder(v%3Dvs.110).aspx\x26sa\=
x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHaVnEaqQ-DNPDwn3rpnAkLCCtOzQ&#39;;return =
true;">C#</a> being prominent examples.<br><br></div></div></blockquote><di=
v>Yes, but keep in mind that std::string is not a counterpart of java.lang.=
String, it is a counterpart of java.lang.StringBuilder. java.lang.Strring i=
s more like std::string_view.<br><br><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); =
padding-left: 1ex;">What compiler/framework are you using that gives you a =
1MB Hello World? I have plenty of debug builds of small programs that use i=
ostreams that don&#39;t even crack 100KB. Release builds of such tools bare=
ly break 20KB.<br></blockquote>I use GNU libstdc++ with gcc. Just add -stat=
ic-libstdc++ -static-libgcc.<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/befa166e-aec2-4bc3-b619-cf2a8ee9cedb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/befa166e-aec2-4bc3-b619-cf2a8ee9cedb=
%40isocpp.org</a>.<br />

------=_Part_1465_1318979768.1487697958215--

------=_Part_1464_776468080.1487697958215--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 21 Feb 2017 09:32:38 -0800 (PST)
Raw View
------=_Part_1459_1820608228.1487698358676
Content-Type: multipart/alternative;
 boundary="----=_Part_1460_564647094.1487698358676"

------=_Part_1460_564647094.1487698358676
Content-Type: text/plain; charset=UTF-8

On Tuesday, February 21, 2017 at 12:11:13 PM UTC-5, Olaf van der Spek wrote:
>
>
>
> Op dinsdag 21 februari 2017 17:21:57 UTC+1 schreef Nicol Bolas:
>>
>> I do not *like* iostreams. I'd rather we have something better and
>> faster. But stringstream solves the problem that the OP wants solved quite
>> adequately.
>>
>
> Performance matters.
> Syntax matters.
>

But your suggested syntax and the iostreams syntax are the same. That's
almost certainly why you choose it.

pilfer() is nice but I don't think it solves everything.
>
>
>> The principle performance problem that stringstream has is the additional
>> copy after formatting. Get rid of that, and most of the performance
>> difference goes away.
>>
>
> What happened to performance issues related to locales and virtual calls?
>

What about it? How much do those things cost?

You can test this easily enough by doing a chain of `operator<<` on a
stringstream, but then not extracting the string from it. Then compare that
to the equivalent set of operations (formatting aside) on a `std::string`.

--
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/73b06839-b51a-4cd9-8316-cb9b3250c157%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, February 21, 2017 at 12:11:13 PM UTC-5, Olaf v=
an der Spek wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr"><br><br>Op dinsdag 21 februari 2017 17:21:57 UTC+1 schreef Nicol Bolas=
:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><div>I do no=
t <i>like</i> iostreams. I&#39;d rather we have something better and faster=
.. But stringstream solves the problem that the OP wants solved quite adequa=
tely. </div></div></div></blockquote><div><br></div><div>Performance matter=
s.</div><div>Syntax matters.</div></div></blockquote><div><br>But your sugg=
ested syntax and the iostreams syntax are the same. That&#39;s almost certa=
inly why you choose it.<br><br></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left:=
 1ex;"><div dir=3D"ltr"><div>pilfer() is nice but I don&#39;t think it solv=
es everything.</div><div>=C2=A0=C2=A0</div><blockquote class=3D"gmail_quote=
" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-le=
ft:1ex"><div dir=3D"ltr"><div><div>The principle performance problem that s=
tringstream has is the additional copy after formatting. Get rid of that, a=
nd most of the performance difference goes away.<br></div></div></div></blo=
ckquote><div><br></div><div>What happened to performance issues related to =
locales and virtual calls?</div></div></blockquote><div><br>What about it? =
How much do those things cost?<br><br>You can test this easily enough by do=
ing a chain of `operator&lt;&lt;` on a stringstream, but then not extractin=
g the string from it. Then compare that to the equivalent set of operations=
 (formatting aside) on a `std::string`.<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/73b06839-b51a-4cd9-8316-cb9b3250c157%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/73b06839-b51a-4cd9-8316-cb9b3250c157=
%40isocpp.org</a>.<br />

------=_Part_1460_564647094.1487698358676--

------=_Part_1459_1820608228.1487698358676--

.


Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Tue, 21 Feb 2017 18:47:59 +0100
Raw View
2017-02-21 18:32 GMT+01:00 Nicol Bolas <jmckesson@gmail.com>:
>> What happened to performance issues related to locales and virtual calls?
>
>
> What about it? How much do those things cost?
>
> You can test this easily enough

Doing benchmarks properly is hard.

> by doing a chain of `operator<<` on a
> stringstream, but then not extracting the string from it. Then compare that
> to the equivalent set of operations (formatting aside) on a `std::string`.

I'm quite sure the overhead is non-zero.. and I'm a fan of the zero
overhead principle.

Besides, moving the string into the stringstream and then moving it
out again make the syntax far worse.


--
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/CAA7U3HMkshMNnw%3DgoKaOpTDfNjz8hBg4pNGQKCwSn%3DXBpHYhXg%40mail.gmail.com.

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 21 Feb 2017 10:29:38 -0800 (PST)
Raw View
------=_Part_481_1357788398.1487701778873
Content-Type: multipart/alternative;
 boundary="----=_Part_482_4033660.1487701778873"

------=_Part_482_4033660.1487701778873
Content-Type: text/plain; charset=UTF-8

On Tuesday, February 21, 2017 at 12:48:02 PM UTC-5, Olaf van der Spek wrote:
>
> 2017-02-21 18:32 GMT+01:00 Nicol Bolas <jmck...@gmail.com <javascript:>>:
> >> What happened to performance issues related to locales and virtual
> calls?
> >
> >
> > What about it? How much do those things cost?
> >
> > You can test this easily enough
>
> Doing benchmarks properly is hard.
>

So is making proposals, yet here we are.

The stringstream pilfer thing needs to happen, regardless of your proposal.
Given that fact, the principle objective motivation for people to use your
mechanism instead of stringstream is performance.

Therefore, the onus is on you to prove that there is a non-trivial
performance difference between the two.

> by doing a chain of `operator<<` on a
> > stringstream, but then not extracting the string from it. Then compare
> that
> > to the equivalent set of operations (formatting aside) on a
> `std::string`.
>
> I'm quite sure the overhead is non-zero.. and I'm a fan of the zero
> overhead principle.
>
> Besides, moving the string into the stringstream and then moving it
> out again make the syntax far worse.
>

Perhaps, but your feature is so limited that a lot of people will have to
do that anyway.

Your `<<` mechanic, as you have specified it, operates on "string_view,
integers, maybe floats but without formatting options." Whereas the
stringstream mechanism supports actual formatting. So there are going to be
quite a few people who won't be able to make use of your "zero overhead"
tool.

Not to mention, we already have tons of code out there that overloads
`operator<<` for streams. They're not all going to suddenly rewrite their
code for `basic_string`. So that's another reason to prefer stringstream
over this tool.

So ugly syntax or not, it's going to be used quite a bit. Indeed, since
people are going to have to be familiar with the stream syntax anyway, odds
are good that people will be confused when you `basic_string` version
*doesn't* allow formatting.

--
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/c8d79c4a-9565-4254-afed-2c4c2a0143fb%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, February 21, 2017 at 12:48:02 PM UTC-5, Olaf v=
an der Spek wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">2017-02-21 1=
8:32 GMT+01:00 Nicol Bolas &lt;<a href=3D"javascript:" target=3D"_blank" gd=
f-obfuscated-mailto=3D"syVb4P4CBwAJ" rel=3D"nofollow" onmousedown=3D"this.h=
ref=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javas=
cript:&#39;;return true;">jmck...@gmail.com</a>&gt;:
<br>&gt;&gt; What happened to performance issues related to locales and vir=
tual calls?
<br>&gt;
<br>&gt;
<br>&gt; What about it? How much do those things cost?
<br>&gt;
<br>&gt; You can test this easily enough
<br>
<br>Doing benchmarks properly is hard.<br></blockquote><div><br>So is makin=
g proposals, yet here we are.<br><br>The stringstream pilfer thing needs to=
 happen, regardless of your proposal. Given that fact, the principle object=
ive motivation for people to use your mechanism instead of stringstream is =
performance.<br><br>Therefore, the onus is on you to prove that there is a =
non-trivial performance difference between the two.<br><br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: =
1px #ccc solid;padding-left: 1ex;">
&gt; by doing a chain of `operator&lt;&lt;` on a
<br>&gt; stringstream, but then not extracting the string from it. Then com=
pare that
<br>&gt; to the equivalent set of operations (formatting aside) on a `std::=
string`.
<br>
<br>I&#39;m quite sure the overhead is non-zero.. and I&#39;m a fan of the =
zero
<br>overhead principle.<br>
<br>Besides, moving the string into the stringstream and then moving it
<br>out again make the syntax far worse.<br></blockquote><div><br>Perhaps, =
but your feature is so limited that a lot of people will have to do that an=
yway.<br><br>Your `&lt;&lt;` mechanic, as you have specified it, operates o=
n &quot;string_view, integers, maybe floats but without formatting options.=
&quot; Whereas the stringstream mechanism supports actual formatting. So th=
ere are going to be quite a few people who won&#39;t be able to make use of=
 your &quot;zero overhead&quot; tool.<br><br>Not to mention, we already hav=
e tons of code out there that overloads `operator&lt;&lt;` for streams. The=
y&#39;re not all going to suddenly rewrite their code for `basic_string`. S=
o that&#39;s another reason to prefer stringstream over this tool.<br><br>S=
o ugly syntax or not, it&#39;s going to be used quite a bit. Indeed, since =
people are going to have to be familiar with the stream syntax anyway, odds=
 are good that people will be confused when you `basic_string` version <i>d=
oesn&#39;t</i> allow formatting.<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/c8d79c4a-9565-4254-afed-2c4c2a0143fb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c8d79c4a-9565-4254-afed-2c4c2a0143fb=
%40isocpp.org</a>.<br />

------=_Part_482_4033660.1487701778873--

------=_Part_481_1357788398.1487701778873--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Tue, 21 Feb 2017 23:35:52 -0800 (PST)
Raw View
------=_Part_10_2127137351.1487748952268
Content-Type: multipart/alternative;
 boundary="----=_Part_11_417207635.1487748952269"

------=_Part_11_417207635.1487748952269
Content-Type: text/plain; charset=UTF-8

On Tuesday, February 21, 2017 at 9:29:39 PM UTC+3, Nicol Bolas wrote:
>
> people will be confused when you `basic_string` version *doesn't* allow
> formatting.
>

We have formatting already. Want formatting - use streams. Want fast and
lightweight serialization for language types without special requirements
to exact form ("just convert to string") - use proposed operators. It is
well-suitable for different form of diagnostics in the program: error
messages, logging, debug and trace.

I constantly use my own class with such functionality:

class string_buffer : public std::string
{
public:
    string_buffer() = default;
    explicit string_buffer(size_type n) { reserve(n); }

    string_buffer &operator<<(const char *str);
    string_buffer &operator<<(const std::string &str);
    string_buffer &operator<<(string_ref sr);
    string_buffer &operator<<(char ch);

    string_buffer &operator<<(long long n);
    string_buffer &operator<<(long n);
    string_buffer &operator<<(int n);
    string_buffer &operator<<(short n);
    string_buffer &operator<<(signed char ch);

    string_buffer &operator<<(unsigned long long n);
    string_buffer &operator<<(unsigned long n);
    string_buffer &operator<<(unsigned n);
    string_buffer &operator<<(unsigned short n);
    string_buffer &operator<<(unsigned char ch);

    string_buffer &operator<<(long double n);
    string_buffer &operator<<(double n);
    string_buffer &operator<<(float n);

    string_buffer &operator<<(bool flag);
    string_buffer &operator<<(const void *p);
};

like this

result_t res = call(...);
if(failed(res)) throw myexception(string_buffer(32) << "Error: result is "
<< res);

So I solved the problem more than 10 years ago for myself, but I think this
would be useful for others too if was added to stdlib.

--
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/210528a6-2a10-4e42-8227-6fa87258d161%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, February 21, 2017 at 9:29:39 PM UTC+3, Nicol B=
olas 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"ltr">pe=
ople will be confused when you `basic_string` version <i>doesn&#39;t</i> al=
low formatting.<br></div></blockquote><div><br>We have formatting already. =
Want formatting - use streams. Want fast and lightweight serialization for =
language types without special requirements to exact form (&quot;just conve=
rt to string&quot;) - use proposed operators. It is well-suitable for diffe=
rent form of diagnostics in the program: error messages, logging, debug and=
 trace.<br><br>I constantly use my own class with such functionality:<br><b=
r><div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187=
, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-w=
ord;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subpr=
ettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">class<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> string_buf=
fer </span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">public</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">string</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">public</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 string_buffer</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">default</span><s=
pan 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><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">explicit</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> string_buffer</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">size_type n</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> reserve</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">n</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=
=A0 string_buffer </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&amp;</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">operator</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&lt;&lt;(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
const</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">char</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">str</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 string_buffer </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">operator</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&lt;&lt;(</span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">::</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">string</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">str</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 string_buffer </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&amp;</span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">operator</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&lt;&lt;(</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">string_ref sr</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>=C2=A0 =C2=A0 string_buffer </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&amp;</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">operator</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&lt;&lt;(</span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">char</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> ch</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=
=C2=A0 =C2=A0 string_buffer </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&amp;</span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">operator</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&lt;&lt;(</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">long</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">long<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> n</span><s=
pan 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 string_bu=
ffer </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">operator</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;(</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">long</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> n</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 string_buffer </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">operator</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;(</span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> n</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 string_buffer </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;(</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">short</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> n</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 string_buffer </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">operator</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&lt;&lt;(</span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">signed</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">char</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> ch</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br><br>=C2=A0 =C2=A0 string_buffer </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">operator</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&lt;&lt;(</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">unsigned</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">long</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
long</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> n</sp=
an><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 stri=
ng_buffer </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&amp;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">opera=
tor</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt=
;(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">unsigned=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">long</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> n</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 string_buffer </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;(</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">unsigned</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> n</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 string_buffer </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;(</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">unsigned</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">short</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> n</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>=C2=A0 =C2=A0 string_buffer </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">operator</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&lt;&lt;(</span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">unsigned</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">char</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> ch</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br><br>=C2=A0 =C2=A0 string_buffer </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&amp;</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">operator</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&lt;&lt;(</span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">long</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">double</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 =
string_buffer </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&amp;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">o=
perator</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt=
;&lt;(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">doub=
le</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 s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 string=
_buffer </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&a=
mp;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">operato=
r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;(=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">float</spa=
n><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><br>=C2=A0 =C2=A0 string_bu=
ffer </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">operator</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;(</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">bool</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> flag</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 string_buffer =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">operator</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;(</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">const</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">p</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"styled-by-prettify">};</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><=
/div></code></div><br>like this<br><br><div style=3D"background-color: rgb(=
250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bord=
er-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;=
" class=3D"styled-by-prettify">result_t res </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> call</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: #008;" class=3D"styled=
-by-prettify">if</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">fai=
led</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">res</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">))</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">throw</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> myexception</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">string_buffer</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">(</span><span style=3D"color: #066;" class=3D"st=
yled-by-prettify">32</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #080;" class=3D"styled-by-prettify">&quot;Error: result=
 is &quot;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> res</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code><=
/div><br>So I solved the problem more than 10 years ago for myself, but I t=
hink this would be useful for others too if was added to stdlib.<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/210528a6-2a10-4e42-8227-6fa87258d161%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/210528a6-2a10-4e42-8227-6fa87258d161=
%40isocpp.org</a>.<br />

------=_Part_11_417207635.1487748952269--

------=_Part_10_2127137351.1487748952268--

.


Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Wed, 22 Feb 2017 09:29:00 +0100
Raw View
2017-02-21 19:29 GMT+01:00 Nicol Bolas <jmckesson@gmail.com>:
> The stringstream pilfer thing needs to happen, regardless of your proposal.

True

> Given that fact, the principle objective motivation for people to use your
> mechanism instead of stringstream is performance.

No, syntax and easy of use are equally important.

>> I'm quite sure the overhead is non-zero.. and I'm a fan of the zero
>> overhead principle.
>>
>> Besides, moving the string into the stringstream and then moving it
>> out again make the syntax far worse.
>
>
> Perhaps, but your feature is so limited that a lot of people will have to do
> that anyway.
>
> Your `<<` mechanic, as you have specified it, operates on "string_view,
> integers, maybe floats but without formatting options." Whereas the
> stringstream mechanism supports actual formatting. So there are going to be
> quite a few people who won't be able to make use of your "zero overhead"
> tool.

Not true.
1. It's not usable everywhere but that doesn't mean it's usable
nowhere, for some people.
2. It's extensible, and if a new formatting functionality does come
along it can be integrated.

> Not to mention, we already have tons of code out there that overloads
> `operator<<` for streams. They're not all going to suddenly rewrite their
> code for `basic_string`. So that's another reason to prefer stringstream
> over this tool.

It'd be nice if such overloads could be generalized.

--
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/CAA7U3HPaoHA4%2BoNDWFWsB30U3RgFe%3DRcQ0K0hvc%2B2U3FGGHgEQ%40mail.gmail.com.

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 22 Feb 2017 07:20:30 -0800 (PST)
Raw View
------=_Part_1707_408724204.1487776830451
Content-Type: multipart/alternative;
 boundary="----=_Part_1708_1876942339.1487776830452"

------=_Part_1708_1876942339.1487776830452
Content-Type: text/plain; charset=UTF-8



On Wednesday, February 22, 2017 at 2:35:52 AM UTC-5, Victor Dyachenko wrote:
>
> On Tuesday, February 21, 2017 at 9:29:39 PM UTC+3, Nicol Bolas wrote:
>>
>> people will be confused when you `basic_string` version *doesn't* allow
>> formatting.
>>
>
> We have formatting already. Want formatting - use streams. Want fast and
> lightweight serialization for language types without special requirements
> to exact form ("just convert to string") - use proposed operators.
>

No, you use `to/from_chars`. They have actual round-trip guarantees. You
cannot reasonably have serialization without round-trip guarantees.


> It is well-suitable for different form of diagnostics in the program:
> error messages, logging, debug and trace.
>

These are all places where performance is *irrelevant*.

At this point, C++ has *three different mechanisms* for converting values
to strings and back. Do we *really* need a fourth? Do we really need
something that lives between the ultra-lightweight and the
slightly-flabby-yet-liveable?

--
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/3ae96e97-89c4-450e-aa7c-06f483b1366e%40isocpp.org.

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

<div dir=3D"ltr"><br><br>On Wednesday, February 22, 2017 at 2:35:52 AM UTC-=
5, Victor Dyachenko 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"ltr">On Tuesday, February 21, 2017 at 9:29:39 PM UTC+3, Nicol Bolas=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">people will=
 be confused when you `basic_string` version <i>doesn&#39;t</i> allow forma=
tting.<br></div></blockquote><div><br>We have formatting already. Want form=
atting - use streams. Want fast and lightweight serialization for language =
types without special requirements to exact form (&quot;just convert to str=
ing&quot;) - use proposed operators.</div></div></blockquote><div><br>No, y=
ou use `to/from_chars`. They have actual round-trip guarantees. You cannot =
reasonably have serialization without round-trip guarantees.<br>=C2=A0</div=
><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bo=
rder-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>It is w=
ell-suitable for different form of diagnostics in the program: error messag=
es, logging, debug and trace.<br></div></div></blockquote><div><br>These ar=
e all places where performance is <i>irrelevant</i>.<br><br>At this point, =
C++ has <i>three different mechanisms</i> for converting values to strings =
and back. Do we <i>really</i> need a fourth? Do we really need something th=
at lives between the ultra-lightweight and the slightly-flabby-yet-liveable=
? <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/3ae96e97-89c4-450e-aa7c-06f483b1366e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3ae96e97-89c4-450e-aa7c-06f483b1366e=
%40isocpp.org</a>.<br />

------=_Part_1708_1876942339.1487776830452--

------=_Part_1707_408724204.1487776830451--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Sat, 25 Feb 2017 09:37:01 -0800 (PST)
Raw View
------=_Part_483_1248975787.1488044221836
Content-Type: multipart/alternative;
 boundary="----=_Part_484_184142141.1488044221836"

------=_Part_484_184142141.1488044221836
Content-Type: text/plain; charset=UTF-8

On Wednesday, February 22, 2017 at 6:20:30 PM UTC+3, Nicol Bolas wrote:
>
>
>
> On Wednesday, February 22, 2017 at 2:35:52 AM UTC-5, Victor Dyachenko
> wrote:
>>
>> On Tuesday, February 21, 2017 at 9:29:39 PM UTC+3, Nicol Bolas wrote:
>>>
>>> people will be confused when you `basic_string` version *doesn't* allow
>>> formatting.
>>>
>>
>> We have formatting already. Want formatting - use streams. Want fast and
>> lightweight serialization for language types without special requirements
>> to exact form ("just convert to string") - use proposed operators.
>>
>
> No, you use `to/from_chars`. They have actual round-trip guarantees. You
> cannot reasonably have serialization without round-trip guarantees.
>
to/from_chars is not generic. It's only a low-lewel build block to convert
numbers <-> memory buffers, even without memory management. It can't  help
with pointers serialization. So it is just a solution of different level.


> It is well-suitable for different form of diagnostics in the program:
>> error messages, logging, debug and trace.
>>
>
> These are all places where performance is *irrelevant*.
>
Is logging performance irrelevant? Really? It's an important part of
functionality of all daemons/services, and its performance mustn't hurt
primary functionality.

At this point, C++ has *three different mechanisms* for converting values
> to strings and back. Do we *really* need a fourth? Do we really need
> something that lives between the ultra-lightweight and the
> slightly-flabby-yet-liveable?
>
Again, there is no generic and at the same time performant standard
mechanism. << for streams looks good in general but, as I have already
mentioned, has some drawbacks.

I can say the same about, for example, exceptions. I like them very much
and use always. But it isn't a reason for me to say that everybody has to
use them too. There are use cases where exceptions are unacceptable, and
C++ should support such users. "One-size-fits-all" often is not a case when
we need not only solution for the task but performance too. Performance and
zero-cost abstractions are main strength of C++. When we don't need
performance we can use any other language: Python, Ruby, Smalltalk,
JavaScript, etc... I like expressiveness of C++ but it is often very
difficult to talk other people into using C++ for industrial projects,
performance is a killer argument here.

--
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/749159d9-704c-4a2e-95ad-0120466161d6%40isocpp.org.

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

<div dir=3D"ltr">On Wednesday, February 22, 2017 at 6:20:30 PM UTC+3, Nicol=
 Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
<br><br>On Wednesday, February 22, 2017 at 2:35:52 AM UTC-5, Victor Dyachen=
ko 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"ltr">On Tuesda=
y, February 21, 2017 at 9:29:39 PM UTC+3, Nicol Bolas wrote:<blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc=
 solid;padding-left:1ex"><div dir=3D"ltr">people will be confused when you =
`basic_string` version <i>doesn&#39;t</i> allow formatting.<br></div></bloc=
kquote><div><br>We have formatting already. Want formatting - use streams. =
Want fast and lightweight serialization for language types without special =
requirements to exact form (&quot;just convert to string&quot;) - use propo=
sed operators.</div></div></blockquote><div><br>No, you use `to/from_chars`=
.. They have actual round-trip guarantees. You cannot reasonably have serial=
ization without round-trip guarantees.<br></div></div></blockquote><div>to/=
from_chars is not generic. It&#39;s only a low-lewel build block to convert=
 numbers &lt;-&gt; memory buffers, even without memory management. It can&#=
39;t=C2=A0 help with pointers serialization. So it is just a solution of di=
fferent level.<br>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"ma=
rgin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">=
<div dir=3D"ltr"><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>It is well-suitable for different form of diagnostics in the program: e=
rror messages, logging, debug and trace.<br></div></div></blockquote><div><=
br>These are all places where performance is <i>irrelevant</i>.<br></div></=
div></blockquote><div>Is logging performance irrelevant? Really? It&#39;s a=
n important part of functionality of  all daemons/services, and its perform=
ance mustn&#39;t hurt primary functionality.<br></div><div><br></div><block=
quote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-le=
ft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>At this point,=
 C++ has <i>three different mechanisms</i> for converting values to strings=
 and back. Do we <i>really</i> need a fourth? Do we really need something t=
hat lives between the ultra-lightweight and the slightly-flabby-yet-liveabl=
e?<br></div></div></blockquote><div>Again, there is no generic and at the s=
ame time performant standard mechanism. &lt;&lt; for streams looks good in =
general but, as I have already mentioned, has some drawbacks.<br><br>I can =
say the same about, for example, exceptions. I like them very much and use =
always. But it isn&#39;t a reason for me to say that everybody has to use t=
hem too. There are use cases where exceptions are unacceptable, and C++ sho=
uld support such users. &quot;One-size-fits-all&quot; often is not a case w=
hen we need not only solution for the task but performance too. Performance=
 and zero-cost abstractions are main strength of C++. When we don&#39;t nee=
d performance we can use any other language: Python, Ruby, Smalltalk, JavaS=
cript, etc... I like expressiveness of C++ but it is often very difficult t=
o talk other people into using C++ for industrial projects, performance is =
a killer argument here.<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/749159d9-704c-4a2e-95ad-0120466161d6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/749159d9-704c-4a2e-95ad-0120466161d6=
%40isocpp.org</a>.<br />

------=_Part_484_184142141.1488044221836--

------=_Part_483_1248975787.1488044221836--

.


Author: olaf@join.cc
Date: Tue, 28 Feb 2017 01:17:25 -0800 (PST)
Raw View
------=_Part_1165_2075919005.1488273445827
Content-Type: multipart/alternative;
 boundary="----=_Part_1166_1763504366.1488273445827"

------=_Part_1166_1763504366.1488273445827
Content-Type: text/plain; charset=UTF-8



Op woensdag 22 februari 2017 08:35:52 UTC+1 schreef Victor Dyachenko:
>
>
> result_t res = call(...);
> if(failed(res)) throw myexception(string_buffer(32) << "Error: result is "
> << res);
>
> So I solved the problem more than 10 years ago for myself, but I think
> this would be useful for others too if was added to stdlib.
>

Can you bind a rvalue to a non-const reference like that?
I love the syntax but I can't make it work..

--
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/df858b3e-ef57-4e31-b1f7-f5a2c0755c87%40isocpp.org.

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

<div dir=3D"ltr"><br><br>Op woensdag 22 februari 2017 08:35:52 UTC+1 schree=
f Victor Dyachenko:<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"><div><br><div style=3D"background-color:rgb(250,250,250);border-color=
:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span sty=
le=3D"color:#000">result_t res </span><span style=3D"color:#660">=3D</span>=
<span style=3D"color:#000"> call</span><span style=3D"color:#660">(...);</s=
pan><span style=3D"color:#000"><br></span><span style=3D"color:#008">if</sp=
an><span style=3D"color:#660">(</span><span style=3D"color:#000">failed</sp=
an><span style=3D"color:#660">(</span><span style=3D"color:#000">res</span>=
<span style=3D"color:#660">))</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#008">throw</span><span style=3D"color:#000"> myexception<=
/span><span style=3D"color:#660">(</span><span style=3D"color:#000">string_=
buffer</span><span style=3D"color:#660">(</span><span style=3D"color:#066">=
32</span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#080">&quot;Error: result is &quot;</span><span =
style=3D"color:#000"> </span><span style=3D"color:#660">&lt;&lt;</span><spa=
n style=3D"color:#000"> res</span><span style=3D"color:#660">);</span><span=
 style=3D"color:#000"><br></span></div></code></div><br>So I solved the pro=
blem more than 10 years ago for myself, but I think this would be useful fo=
r others too if was added to stdlib.<br></div></div></blockquote><div><br><=
/div><div>Can you bind a rvalue to a non-const reference like that?</div><d=
iv>I love the syntax but I can&#39;t make it work..=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/df858b3e-ef57-4e31-b1f7-f5a2c0755c87%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/df858b3e-ef57-4e31-b1f7-f5a2c0755c87=
%40isocpp.org</a>.<br />

------=_Part_1166_1763504366.1488273445827--

------=_Part_1165_2075919005.1488273445827--

.


Author: Victor Dyachenko <victor.dyachenko@gmail.com>
Date: Tue, 28 Feb 2017 02:40:01 -0800 (PST)
Raw View
------=_Part_1077_530352560.1488278402038
Content-Type: multipart/alternative;
 boundary="----=_Part_1078_787191150.1488278402038"

------=_Part_1078_787191150.1488278402038
Content-Type: text/plain; charset=UTF-8

On Tuesday, February 28, 2017 at 12:17:26 PM UTC+3, ol...@join.cc wrote:
>
>
>
> Op woensdag 22 februari 2017 08:35:52 UTC+1 schreef Victor Dyachenko:
>>
>>
>> result_t res = call(...);
>> if(failed(res)) throw myexception(string_buffer(32) << "Error: result is
>> " << res);
>>
>> So I solved the problem more than 10 years ago for myself, but I think
>> this would be useful for others too if was added to stdlib.
>>
>
> Can you bind a rvalue to a non-const reference like that?
> I love the syntax but I can't make it work..
>
If you mean operator<<, it is a class member (see above). But you can make
it free function as well using rvalue refs:

std::string &operator<<(std::string &s, int n) { .... }
inline std::string &operator<<(std::string &&s, int n) { return s << n; }

--
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/79ea3493-66f4-4386-9210-f3a3b80e0f30%40isocpp.org.

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

<div dir=3D"ltr">On Tuesday, February 28, 2017 at 12:17:26 PM UTC+3, ol...@=
join.cc wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"=
><br><br>Op woensdag 22 februari 2017 08:35:52 UTC+1 schreef Victor Dyachen=
ko:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br><div s=
tyle=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bor=
der-style:solid;border-width:1px"><code><div><span style=3D"color:#000">res=
ult_t res </span><span style=3D"color:#660">=3D</span><span style=3D"color:=
#000"> call</span><span style=3D"color:#660">(...);</span><span style=3D"co=
lor:#000"><br></span><span style=3D"color:#008">if</span><span style=3D"col=
or:#660">(</span><span style=3D"color:#000">failed</span><span style=3D"col=
or:#660">(</span><span style=3D"color:#000">res</span><span style=3D"color:=
#660">))</span><span style=3D"color:#000"> </span><span style=3D"color:#008=
">throw</span><span style=3D"color:#000"> myexception</span><span style=3D"=
color:#660">(</span><span style=3D"color:#000">string_buffer</span><span st=
yle=3D"color:#660">(</span><span style=3D"color:#066">32</span><span style=
=3D"color:#660">)</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#660">&lt;&lt;</span><span style=3D"color:#000"> </span><span style=3D=
"color:#080">&quot;Error: result is &quot;</span><span style=3D"color:#000"=
> </span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#00=
0"> res</span><span style=3D"color:#660">);</span><span style=3D"color:#000=
"><br></span></div></code></div><br>So I solved the problem more than 10 ye=
ars ago for myself, but I think this would be useful for others too if was =
added to stdlib.<br></div></div></blockquote><div><br></div><div>Can you bi=
nd a rvalue to a non-const reference like that?</div><div>I love the syntax=
 but I can&#39;t make it work..=C2=A0</div></div></blockquote><div>If you m=
ean operator&lt;&lt;, it is a class member (see above). But you can make it=
 free function as well using rvalue refs:<br><br><div style=3D"background-c=
olor: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: s=
olid; border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint">=
<code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">std</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">string</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&amp;</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">operator</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&lt;&lt;(</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #008;" class=3D"styled-by-prettify">string</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">s</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> n</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">....</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">inline</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
string</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">operator</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;(</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">string</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">s</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">i=
nt</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 st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">return</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> s </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> n</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span></div><=
/code></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/79ea3493-66f4-4386-9210-f3a3b80e0f30%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/79ea3493-66f4-4386-9210-f3a3b80e0f30=
%40isocpp.org</a>.<br />

------=_Part_1078_787191150.1488278402038--

------=_Part_1077_530352560.1488278402038--

.