Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10264
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Ian Collins <ian-news@hotmail.com> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: stl copy and istream_iterator and operator >> |
| Date | Mon, 19 Sep 2011 10:11:30 +1200 |
| Lines | 25 |
| Message-ID | <9dn8kiFr5dU11@mid.individual.net> (permalink) |
| References | <cd8da4eb-33c9-4b2f-8d75-b2348dcc33a0@s7g2000yqd.googlegroups.com> <9dn78fFr5dU9@mid.individual.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net B/XP+H2/JiwPF2G4E6xRTwkWuOgiex2vAZs4llQt+iv5WaMw8V |
| Cancel-Lock | sha1:sKuH3nFHjDbcoMYLqXhop8O9Kt8= |
| User-Agent | Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 |
| In-Reply-To | <9dn78fFr5dU9@mid.individual.net> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:10264 |
Show key headers only | View raw
On 09/19/11 09:47 AM, Ian Collins wrote:
> On 09/19/11 09:27 AM, persres@googlemail.com wrote:
>> Hi,
>> I have the following code -
>>
>> string str("12 3213 asdf 21");
>> vector<int> v;
>>
>> copy(istream_iterator<int>(istringstream(str)) ,
>> istream_iterator<int>(), back_inserter(v) );
>
> This shouldn't compile. You can't create an istream_iterator from a
> temporary.
>
>> I expected copy to throw because the operator>> would have failed due
>> to the 'asdf' string present.
>
> Which operator>>?
I wasn't being very helpful there (Monday morning).
std::istream_iterator will stop after the first extraction failure, so
if you want more error checking you will have to roll your own.
--
Ian Collins
Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread
stl copy and istream_iterator and operator >> "persres@googlemail.com" <persres@gmail.com> - 2011-09-18 14:27 -0700
Re: stl copy and istream_iterator and operator >> Ian Collins <ian-news@hotmail.com> - 2011-09-19 09:47 +1200
Re: stl copy and istream_iterator and operator >> "persres@googlemail.com" <persres@gmail.com> - 2011-09-18 14:53 -0700
Re: stl copy and istream_iterator and operator >> Ian Collins <ian-news@hotmail.com> - 2011-09-19 10:00 +1200
Re: stl copy and istream_iterator and operator >> "persres@googlemail.com" <persres@gmail.com> - 2011-09-18 15:11 -0700
Re: stl copy and istream_iterator and operator >> red floyd <no.spam.here@its.invalid> - 2011-09-18 15:23 -0700
Re: stl copy and istream_iterator and operator >> Ian Collins <ian-news@hotmail.com> - 2011-09-19 10:23 +1200
Re: stl copy and istream_iterator and operator >> James Kanze <james.kanze@gmail.com> - 2011-09-19 15:19 -0700
Re: stl copy and istream_iterator and operator >> Ian Collins <ian-news@hotmail.com> - 2011-09-19 10:11 +1200
csiph-web