Topic: istream_iterator delimiter(s)


Author: Jeaye Wilkerson <contact@jeaye.com>
Date: Fri, 11 Apr 2014 00:22:13 -0700 (PDT)
Raw View
------=_Part_1961_8800640.1397200933411
Content-Type: text/plain; charset=UTF-8

Just as it's possible to write something like:

vector<string> vec; // ...
copy(begin(vec), end(vec), ostream_iterator<string>(cout, "\n"));

I propose it be possible to write something like:

vector<string> vec;
istringstream iss; // some input stream with several lines of data
copy(istream_iterator<string>(iss, "\n"), istream_iterator<string>(),back_inserter
(vec)); // ala getline, but supplies an arbitrary number of patterns

The new second parameter *(optional) *for the istream_iterator constructor
represents a collection of all delimiter chars. This would default to all
whitespace characters.

*Pros:*

   - Ability to specify arbitrary tokenization delimiters without the need
   for extensive ctype specialization or something else nasty
      - Reading something like an IP: *127.0.0.1* into its components can
      now be specified in terms of istream_iterator's delimiter
   - Relatively familiar approach ala ostream_iterator and getline
   - Backward compatible and non-intrusive

*Cons:*

   - Locale problems?
   - Only supplied for istream_iterator<string> specialization? (could also
   work with other types!)

istringstream iss{ "0.1|0.2|0.3|0.4" }; // current istream_iterator will
choke on this
copy(istream_iterator<double>(iss, "|"), istream_iterator<double>(),ostream_iterator
<double>(cout, " ")); // prints "0.1 0.2 0.3"

I know that each of these can be implemented with custom input iterators;
that's not the point.

--

---
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_1961_8800640.1397200933411
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Just as it's possible to write something like:<br><br><div=
 class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); borde=
r-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-w=
rap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"=
><span style=3D"color: #000;" class=3D"styled-by-prettify">vector</span><sp=
an style=3D"color: #080;" class=3D"styled-by-prettify">&lt;string&gt;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> vec</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: #=
800;" class=3D"styled-by-prettify">// ...</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>copy</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">begin</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">vec</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">end</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">vec</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">),</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> ostream_iterator</span><span style=3D"color: #08=
0;" class=3D"styled-by-prettify">&lt;string&gt;</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">cout</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pret=
tify">"\n"</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
));</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan></div></code></div><br>I propose it be possible to write something like=
:<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250=
, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width=
: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"su=
bprettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettify">vec=
tor</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;str=
ing&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ve=
c</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br>istringstream =
iss</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #800;" class=3D"styled-by-prettify">// some input stream with=
 several lines of data</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>copy</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>istream_iterator</span><span style=3D"color: #080;" class=3D"styled-by-pre=
ttify">&lt;string&gt;</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">iss</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #080;" class=3D"styled-by-prettify">"\n"</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">),</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> istream_iterator</span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">&lt;string&gt;</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(),</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> back_inserter</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">vec</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">));</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"styl=
ed-by-prettify">// ala getline, but supplies an arbitrary number of pattern=
s</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n></div></code></div><br>The new second parameter <i>(optional) </i>for the=
 istream_iterator constructor represents a collection of all delimiter char=
s. This would default to all whitespace characters.<br><b><br>Pros:</b><br>=
<ul><li>Ability to specify arbitrary tokenization delimiters without the ne=
ed for extensive ctype specialization or something else nasty</li><ul><li>R=
eading something like an IP: <b>127.0.0.1</b> into its components can now b=
e specified in terms of istream_iterator's delimiter</li></ul><li>Relativel=
y familiar approach ala ostream_iterator and getline</li><li>Backward compa=
tible and non-intrusive</li></ul><b>Cons:</b><br><ul><li>Locale problems?</=
li><li>Only supplied for istream_iterator&lt;string&gt; specialization? (co=
uld also work with other types!)</li></ul><div class=3D"prettyprint" style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
 border-style: solid; border-width: 1px; word-wrap: break-word;"><code clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;=
" class=3D"styled-by-prettify">istringstream iss</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: #080;" class=3D"=
styled-by-prettify">"0.1|0.2|0.3|0.4"</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>// current istream_iterator will choke on this</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br>copy</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">istream_iterator</span><span style=3D"color: #080=
;" class=3D"styled-by-prettify">&lt;double&gt;</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">iss</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: #080;" class=3D"styled-by-prettify=
">"|"</span><span style=3D"color: #660;" class=3D"styled-by-prettify">),</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> istream_iter=
ator</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;do=
uble&gt;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()=
,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ostream_=
iterator</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&l=
t;double&gt;</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">cout</s=
pan><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: #080;" 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 style=3D"color: #800;" class=3D=
"styled-by-prettify">// prints "0.1 0.2 0.3"</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span></div></code></div><br>I know =
that each of these can be implemented with custom input iterators; that's n=
ot the point.<br></div>

<p></p>

-- <br />
<br />
--- <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 />
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_1961_8800640.1397200933411--

.


Author: Jeaye Wilkerson <contact@jeaye.com>
Date: Fri, 11 Apr 2014 00:27:38 -0700 (PDT)
Raw View
------=_Part_2017_2331431.1397201258886
Content-Type: text/plain; charset=UTF-8

Just as it's possible to write something like:

vector<string> vec; // ...
copy(begin(vec), end(vec), ostream_iterator<string>(cout, "\n"));

I propose it be possible to write something like:

vector<string> vec;
istringstream iss; // some input stream with several lines of data
copy(istream_iterator<string>(iss, "\n"), istream_iterator<string>(),back_inserter
(vec)); // ala getline, but supplies an arbitrary number of patterns

The new second parameter *(optional) *for the istream_iterator constructor
represents a collection of all delimiter chars. This would default to all
whitespace characters.

*Pros:*

   - Ability to specify arbitrary tokenization delimiters without the need
   for extensive ctype specialization or something else nasty
      - Reading something like an IP: *127.0.0.1* into its components can
      now be specified in terms of istream_iterator's delimiter
   - Relatively familiar approach ala ostream_iterator and getline
   - Backward compatible and non-intrusive

*Cons:*

   - Locale problems?
   - Only supplied for istream_iterator<string> specialization? (could also
   work with other types!)

istringstream iss{ "0.1|0.2|0.3" }; // current istream_iterator will choke
on this
copy(istream_iterator<double>(iss, "|"), istream_iterator<double>(),ostream_iterator
<double>(cout, " ")); // prints "0.1 0.2 0.3"

I know that each of these can be implemented with custom input iterators;
that's not the point.

--

---
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_2017_2331431.1397201258886
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Just as it's possible to write something like:<br><br><div=
 style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);b=
order-style:solid;border-width:1px;word-wrap:break-word"><code><div><span s=
tyle=3D"color:#000">vector</span><span style=3D"color:#080">&lt;string&gt;<=
/span><span style=3D"color:#000"> vec</span><span style=3D"color:#660">;</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#800">// ...</s=
pan><span style=3D"color:#000"><br>copy</span><span style=3D"color:#660">(<=
/span><span style=3D"color:#008">begin</span><span style=3D"color:#660">(</=
span><span style=3D"color:#000">vec</span><span style=3D"color:#660">),</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#008">end</span>=
<span style=3D"color:#660">(</span><span style=3D"color:#000">vec</span><sp=
an style=3D"color:#660">),</span><span style=3D"color:#000"> ostream_iterat=
or</span><span style=3D"color:#080">&lt;string&gt;</span><span style=3D"col=
or:#660">(</span><span style=3D"color:#000">cout</span><span style=3D"color=
:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#080=
">"\n"</span><span style=3D"color:#660">));</span><span style=3D"color:#000=
"><br></span></div></code></div><br>I propose it be possible to write somet=
hing like:<br><br><div style=3D"background-color:rgb(250,250,250);border-co=
lor:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-wo=
rd"><code><div><span style=3D"color:#000">vector</span><span style=3D"color=
:#080">&lt;string&gt;</span><span style=3D"color:#000"> vec</span><span sty=
le=3D"color:#660">;</span><span style=3D"color:#000"><br>istringstream iss<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"> </span=
><span style=3D"color:#800">// some input stream with several lines of data=
</span><span style=3D"color:#000"><br>copy</span><span style=3D"color:#660"=
>(</span><span style=3D"color:#000">istream_iterator</span><span style=3D"c=
olor:#080">&lt;string&gt;</span><span style=3D"color:#660">(</span><span st=
yle=3D"color:#000"><wbr>iss</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000"> </span><span style=3D"color:#080">"\n"</span><span st=
yle=3D"color:#660">),</span><span style=3D"color:#000"> istream_iterator</s=
pan><span style=3D"color:#080">&lt;string&gt;</span><span style=3D"color:#6=
60">(),</span><span style=3D"color:#000"> back_inserter</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">vec</span><span style=3D=
"color:#660">));</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#800">// ala getline, but supplies an arbitrary number of patterns</spa=
n><span style=3D"color:#000"><br></span></div></code></div><br>The new seco=
nd parameter <i>(optional) </i>for
 the istream_iterator constructor represents a collection of all=20
delimiter chars. This would default to all whitespace characters.<br><b><br=
>Pros:</b><br><ul><li>Ability to specify arbitrary tokenization delimiters =
without the need for extensive ctype specialization or something else nasty=
</li><ul><li>Reading something like an IP: <b>127.0.0.1</b> into its compon=
ents can now be specified in terms of istream_iterator's delimiter</li></ul=
><li>Relatively familiar approach ala ostream_iterator and getline</li><li>=
Backward compatible and non-intrusive</li></ul><b>Cons:</b><br><ul><li>Loca=
le problems?</li><li>Only supplied for istream_iterator&lt;string&gt; speci=
alization? (could also work with other types!)</li></ul><div style=3D"backg=
round-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:sol=
id;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#=
000">istringstream iss</span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"> </span><span style=3D"color:#080">"0.1|0.2|0.3"</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#660">};</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#800">// current istream_it=
erator will choke on this</span><span style=3D"color:#000"><br>copy</span><=
span style=3D"color:#660">(</span><span style=3D"color:#000">istream_iterat=
or</span><span style=3D"color:#080">&lt;double&gt;</span><span style=3D"col=
or:#660">(</span><span style=3D"color:#000"><wbr>iss</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:=
#080">"|"</span><span style=3D"color:#660">),</span><span style=3D"color:#0=
00"> istream_iterator</span><span style=3D"color:#080">&lt;double&gt;</span=
><span style=3D"color:#660">(),</span><span style=3D"color:#000"> ostream_i=
terator</span><span style=3D"color:#080">&lt;double&gt;</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">cout</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#080">" "</span><span style=3D"color:#660">));</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#800">// prints "0.1 0.2 0.3"</span>=
<span style=3D"color:#000"><br></span></div></code></div><br>I know that ea=
ch of these can be implemented with custom input iterators; that's not the =
point.</div>

<p></p>

-- <br />
<br />
--- <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 />
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_2017_2331431.1397201258886--

.


Author: David Krauss <potswa@gmail.com>
Date: Fri, 11 Apr 2014 15:36:33 +0800
Raw View
--Apple-Mail=_15D079EE-92C9-42E3-AEBE-F9597F97AF7A
Content-Type: text/plain; charset=ISO-8859-1


On 2014-04-11, at 3:22 PM, Jeaye Wilkerson <contact@jeaye.com> wrote:

> The new second parameter (optional) for the istream_iterator constructor represents a collection of all delimiter chars. This would default to all whitespace characters.

Defaulting to all whitespace characters would mean that istream_iterator<string> would by default return only a single string before quitting. Making the argument optional would break all existing istream_iterator<string> code.

istream_iterator is not really suitable for parsing because it doesn't have state besides the single character of putback guaranteed by streambuf.

Such a proposal might have a better chance with an implementation. You could probably achieve this by inheriting from istream_iterator. Perhaps even build a real parser around it too. It's up to you though.

--

---
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/.

--Apple-Mail=_15D079EE-92C9-42E3-AEBE-F9597F97AF7A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;04&ndash;11, at 3:22 PM, Jeaye Wilkerson &lt;<a href=3D"mailto:contac=
t@jeaye.com">contact@jeaye.com</a>&gt; wrote:</div><br class=3D"Apple-inter=
change-newline"><blockquote type=3D"cite"><div dir=3D"ltr">The new second p=
arameter <i>(optional) </i>for the istream_iterator constructor represents =
a collection of all delimiter chars. This would default to all whitespace c=
haracters.<br></div></blockquote><div><br></div>Defaulting to all whitespac=
e characters would mean that istream_iterator&lt;string&gt; would by defaul=
t return only a single string before quitting. Making the argument optional=
 would break all existing istream_iterator&lt;string&gt; code.</div><div><b=
r></div><div>istream_iterator is not really suitable for parsing because it=
 doesn&rsquo;t have state besides the single character of putback guarantee=
d by streambuf.</div><div><br></div><div>Such a proposal might have a bette=
r chance with an implementation. You could probably achieve this by inherit=
ing from istream_iterator. Perhaps even build a real parser around it too. =
It&rsquo;s up to you though.</div><div><br></div></body></html>

<p></p>

-- <br />
<br />
--- <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 />
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 />

--Apple-Mail=_15D079EE-92C9-42E3-AEBE-F9597F97AF7A--

.


Author: Jeaye Wilkerson <contact@jeaye.com>
Date: Fri, 11 Apr 2014 20:47:55 -0700 (PDT)
Raw View
------=_Part_608_15964083.1397274475601
Content-Type: text/plain; charset=UTF-8


>
> Defaulting to all whitespace characters would mean that
> istream_iterator<string> would by default return only a single string
> before quitting. Making the argument optional would break all existing
> istream_iterator<string> code.
>

The idea is that the normal code for finding when to *start* still remains,
the delimiter just says when to *end*. With that said,
istream_iterator<string> would skip preceding whitespace as expected, read
all non-whitespace, as expected, until it hits one of the delimiters. I
understand the desire for an implementtion; one may be provided.

--

---
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_608_15964083.1397274475601
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-lef=
t: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">=
Defaulting to all whitespace characters would mean that=20
istream_iterator&lt;string&gt; would by default return only a single=20
string before quitting. Making the argument optional would break all=20
existing istream_iterator&lt;string&gt; code.<br></blockquote><div>&nbsp;<b=
r>The idea is that the normal code for finding when to <b>start</b> still r=
emains, the delimiter just says when to <b>end</b>. With that said, istream=
_iterator&lt;string&gt; would skip preceding whitespace as expected, read a=
ll non-whitespace, as expected, until it hits one of the delimiters. I unde=
rstand the desire for an implementtion; one may be provided.<br></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&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 />
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_608_15964083.1397274475601--

.


Author: David Krauss <potswa@gmail.com>
Date: Sat, 12 Apr 2014 12:22:13 +0800
Raw View
--Apple-Mail=_72AD31FE-3A0A-4502-B2AF-31B5B83E568C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1


On 2014-04-12, at 11:47 AM, Jeaye Wilkerson <contact@jeaye.com> wrote:

> Defaulting to all whitespace characters would mean that istream_iterator<=
string> would by default return only a single string before quitting. Makin=
g the argument optional would break all existing istream_iterator<string> c=
ode.
> =20
> The idea is that the normal code for finding when to start still remains,=
 the delimiter just says when to end. With that said, istream_iterator<stri=
ng> would skip preceding whitespace as expected, read all non-whitespace, a=
s expected, until it hits one of the delimiters.

And then it quits and becomes equal to the singular default value std::istr=
eam_iterator<string>(), having read at most one single string given the def=
ault delimiter set. This isn't very useful.

You might consider defining an extractor class instead, containing a refere=
nce to a string and a set of delimiters. Attempting to extract a delimiter =
sets failbit. Instantiating istream_iterator with the extractor will provid=
e the desired semantics.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_72AD31FE-3A0A-4502-B2AF-31B5B83E568C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;04&ndash;12, at 11:47 AM, Jeaye Wilkerson &lt;<a href=3D"mailto:conta=
ct@jeaye.com">contact@jeaye.com</a>&gt; wrote:</div><br class=3D"Apple-inte=
rchange-newline"><blockquote type=3D"cite"><div dir=3D"ltr"><blockquote sty=
le=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204);=
 padding-left: 1ex;" class=3D"gmail_quote">Defaulting to all whitespace cha=
racters would mean that=20
istream_iterator&lt;string&gt; would by default return only a single=20
string before quitting. Making the argument optional would break all=20
existing istream_iterator&lt;string&gt; code.<br></blockquote><div>&nbsp;<b=
r>The idea is that the normal code for finding when to <b>start</b> still r=
emains, the delimiter just says when to <b>end</b>. With that said, istream=
_iterator&lt;string&gt; would skip preceding whitespace as expected, read a=
ll non-whitespace, as expected, until it hits one of the delimiters.</div><=
/div></blockquote><div><br></div><div>And then it quits and becomes equal t=
o the singular default value <font face=3D"Courier">std::istream_iterator&l=
t;string&gt;()</font>, having read at most one single string given the defa=
ult delimiter set. This isn&rsquo;t very useful.</div></div><div><br></div>=
<div>You might consider defining an extractor class instead, containing a r=
eference to a string and a set of delimiters. Attempting to extract a delim=
iter sets <font face=3D"Courier">failbit</font>. Instantiating <font face=
=3D"Courier">istream_iterator</font> with the extractor will provide the de=
sired semantics.</div><div><br></div></body></html>

<p></p>

-- <br />
<br />
--- <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 />
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 />

--Apple-Mail=_72AD31FE-3A0A-4502-B2AF-31B5B83E568C--

.