Topic: basic_string<> inserter
Author: n2xssvv.g02gfr12930@ntlworld.com (n2xssvv g02gfr12930)
Date: Mon, 3 Jul 2006 19:39:20 GMT Raw View
Is this suppose to default to skip leading whitespace? This doesn't
appear to be the case from 21.3.7.9 and 27.6.1.1.2 which suggests the
default sentry. Only gcc 3.3 does skip leading whitespace, is this an error?
JB
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: jdennett@acm.org (James Dennett)
Date: Mon, 3 Jul 2006 20:00:39 GMT Raw View
n2xssvv g02gfr12930 wrote:
> Is this suppose to default to skip leading whitespace? This doesn't
> appear to be the case from 21.3.7.9 and 27.6.1.1.2 which suggests the
> default sentry. Only gcc 3.3 does skip leading whitespace, is this an
> error?
The inserter which writes a std::basic_string into a stream
does not skip any characters, but rather writes out all of
the characters in the string. (I confirmed that with gcc 3.3,
though it wasn't really in doubt.)
Extraction does skip whitespace (and terminate at whitespace).
-- James
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: n2xssvv g02gfr12930 <n2xssvv.g02gfr12930@ntlworld.com>
Date: Tue, 4 Jul 2006 09:43:12 CST Raw View
n2xssvv g02gfr12930 wrote:
> Is this suppose to default to skip leading whitespace? This doesn't
> appear to be the case from 21.3.7.9 and 27.6.1.1.2 which suggests the
> default sentry. Only gcc 3.3 does skip leading whitespace, is this an
> error?
>
> JB
>
> ---
> [ comp.std.c++ is moderated. To submit articles, try just posting with ]
> [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
> [ --- Please see the FAQ before posting. --- ]
> [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
>
Just to be clear string<> skips leading whitespace and I cannot find
anything in the standard that makes that explicit. This would appear to
be what's expected.
JB
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: AlbertoBarbati@libero.it (Alberto Ganesh Barbati)
Date: Tue, 4 Jul 2006 18:10:27 GMT Raw View
n2xssvv g02gfr12930 ha scritto:
> n2xssvv g02gfr12930 wrote:
>> Is this suppose to default to skip leading whitespace? This doesn't
>> appear to be the case from 21.3.7.9 and 27.6.1.1.2 which suggests the
>> default sentry. Only gcc 3.3 does skip leading whitespace, is this an
>> error?
Are you possibly making confusion between inserters (== writing to an
ostream) and extractors (== reading from an istream)?
As answered by James Dennet, the inserters never skip whitespaces, but
extractors might do it. In particular, extractors do that by default,
precisely the task is performed by the sentry object when constructed
with only one parameter (as noskipws = false).
> Just to be clear string<> skips leading whitespace and I cannot find
> anything in the standard that makes that explicit. This would appear to
> be what's expected.
What's that supposed to mean? string<> is a class and not a function so
it doesn't "skip" anything because it's not something that actually
"executes". The best thing you can do to try to explain yourself is to
post the exact code that you are talking about, providing the expected
output as well as the (possibly wrong) actual output. It greatly helps
people who can't read your mind (like me, for example) to help you... ;)
Ganesh
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]