Topic: Using initializer lists with streams
Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Tue, 9 Jun 2015 08:21:19 -0700 (PDT)
Raw View
------=_Part_252_1803678498.1433863279291
Content-Type: multipart/alternative;
boundary="----=_Part_253_545354834.1433863279291"
------=_Part_253_545354834.1433863279291
Content-Type: text/plain; charset=UTF-8
I have the following funny idea :)
std::stringstream ss( { "Hello", "everybody" } );
std:;string s;
while ( ss >> s ) std::cout << s << std::endl;
or
std::stringstream ss( { 2015, 6, 9 } );
int x;
while ( ss >> x ) std::cout << x << std::endl;
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_253_545354834.1433863279291
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>I have the following funny idea :)</div><div><br></di=
v><div>std::stringstream ss( { "Hello", "everybody" } );</div><div><br></di=
v><div>std:;string s;</div><div><br></div><div>while ( ss >> s ) std:=
:cout << s << std::endl;</div><div><br></div><div>or</div><div>=
<br></div><div><div>std::stringstream ss( { 2015, 6, 9 } );</div>=
</div><div><br></div><div>int x;</div><div><br></div><div><div>while ( ss &=
gt;> x ) std::cout << x << std::endl;</div></div><=
/div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_253_545354834.1433863279291--
------=_Part_252_1803678498.1433863279291--
.
Author: Benjamin Lindley <benjameslindley@gmail.com>
Date: Tue, 9 Jun 2015 10:22:53 -0700 (PDT)
Raw View
------=_Part_1962_1133972362.1433870573881
Content-Type: multipart/alternative;
boundary="----=_Part_1963_1903604656.1433870573881"
------=_Part_1963_1903604656.1433870573881
Content-Type: text/plain; charset=UTF-8
Is that just looping over each element and passing them to operator<<,
resulting in one long concatenated string? Or is it inserting a whitespace
character (and which one) between each item?
On Tuesday, June 9, 2015 at 10:21:19 AM UTC-5, Vlad from Moscow wrote:
>
> I have the following funny idea :)
>
> std::stringstream ss( { "Hello", "everybody" } );
>
> std:;string s;
>
> while ( ss >> s ) std::cout << s << std::endl;
>
> or
>
> std::stringstream ss( { 2015, 6, 9 } );
>
> int x;
>
> while ( ss >> x ) std::cout << x << std::endl;
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_1963_1903604656.1433870573881
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Is that just looping over each element and passing them to=
operator<<, resulting in one long concatenated string? Or is it inse=
rting a whitespace character (and which one) between each item?<br><br>On T=
uesday, June 9, 2015 at 10:21:19 AM UTC-5, Vlad from Moscow wrote:<blockquo=
te 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>I have the follow=
ing funny idea :)</div><div><br></div><div>std::stringstream ss( { "Hello",=
"everybody" } );</div><div><br></div><div>std:;string s;</div><div><br></d=
iv><div>while ( ss >> s ) std::cout << s << std::endl;</d=
iv><div><br></div><div>or</div><div><br></div><div><div>std::stringstream s=
s( { 2015, 6, 9 } );</div></div><div><br></div><div>int x;</div><=
div><br></div><div><div>while ( ss >> x ) std::cout <<&nbs=
p;x << std::endl;</div></div></div></blockquote></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_1963_1903604656.1433870573881--
------=_Part_1962_1133972362.1433870573881--
.
Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Tue, 9 Jun 2015 10:46:33 -0700 (PDT)
Raw View
------=_Part_3189_467502728.1433871993940
Content-Type: multipart/alternative;
boundary="----=_Part_3190_1823168770.1433871993940"
------=_Part_3190_1823168770.1433871993940
Content-Type: text/plain; charset=UTF-8
To provide that the operator >> would work there should be white space
characters between the items.
On Tuesday, June 9, 2015 at 8:22:53 PM UTC+3, Benjamin Lindley wrote:
>
> Is that just looping over each element and passing them to operator<<,
> resulting in one long concatenated string? Or is it inserting a whitespace
> character (and which one) between each item?
>
> On Tuesday, June 9, 2015 at 10:21:19 AM UTC-5, Vlad from Moscow wrote:
>>
>> I have the following funny idea :)
>>
>> std::stringstream ss( { "Hello", "everybody" } );
>>
>> std:;string s;
>>
>> while ( ss >> s ) std::cout << s << std::endl;
>>
>> or
>>
>> std::stringstream ss( { 2015, 6, 9 } );
>>
>> int x;
>>
>> while ( ss >> x ) std::cout << x << std::endl;
>>
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_3190_1823168770.1433871993940
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">To provide that the operator >> would work there sho=
uld be white space characters between the items.<br><br>On Tuesday, June 9,=
2015 at 8:22:53 PM UTC+3, Benjamin Lindley wrote:<blockquote class=3D"gmai=
l_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left=
-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: soli=
d;"><div dir=3D"ltr">Is that just looping over each element and passing the=
m to operator<<, resulting in one long concatenated string? Or is it =
inserting a whitespace character (and which one) between each item?<br><br>=
On Tuesday, June 9, 2015 at 10:21:19 AM UTC-5, Vlad from Moscow wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-le=
ft: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; bor=
der-left-style: solid;"><div dir=3D"ltr"><div>I have the following funny id=
ea :)</div><div><br></div><div>std::stringstream ss( { "Hello", "everybody"=
} );</div><div><br></div><div>std:;string s;</div><div><br></div><div>whil=
e ( ss >> s ) std::cout << s << std::endl;</div><div><br>=
</div><div>or</div><div><br></div><div><div>std::stringstream ss( { 20=
15, 6, 9 } );</div></div><div><br></div><div>int x;</div><div><br></di=
v><div><div>while ( ss >> x ) std::cout << x <<=
std::endl;</div></div></div></blockquote></div></blockquote></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_3190_1823168770.1433871993940--
------=_Part_3189_467502728.1433871993940--
.