incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Pevtsov <ant...@moscow.vdiweb.com>
Subject test for lib.string.io
Date Tue, 20 Jun 2006 15:29:16 GMT
Martin, I am working on the test for lib.string.io and there are several
questions:

1. Shall we implement an our own locale class to exercise the >> and <<
operators using it?

2. Small question about 21.3.7.9, paragraph 4:

"
Effects: Begins by constructing a sentry object k as if k were
constructed by typename basic_ostream<chart, thraits>::sentry k(os). 
If bool(k) is true, inserts characters as if by calling
os.rdbuf()->sputn(str.data(), n), padding as described in stage 3 of
22.2.2.2.2, where n is the larger of os.width() and str.size(); then
calls os.width(0). If the call to sputn fails, calls
os.setstate(iosbase::failbit).
"

As I understand os.width(0) should be called if bool(k) is true only. I
not sure, but Dinkumware STL from MSVC and STLPort does that while
stdcxx calls os.with(0) in any case:

incubator\stdcxx\trunk\include\ostream

// 21.3.7.9, p3 - defined here, declared inline in <string>
template<class _CharT, class _Traits, class _Allocator> inline
basic_ostream<_CharT, _Traits>&
operator<< (basic_ostream<_CharT, _Traits>                  & __strm,
            const basic_string<_CharT, _Traits, _Allocator> &__str) {
    _RW::__rw_insert (__strm, __str.data (), __str.length (),
                      __strm.width ()).width (0);
    return __strm;
}
 
Is this correct?
The attached small test (iocheck.cpp) to illustrate this situation. 

3. Another small question about 21.3.7.9 paragraph 4:

The stdcxx calls os.setstate(ios_base::badbit). Dinkumware STL does the
same. STLPort  - according to standard.

The attached small test (iocheck2.cpp) to illustrate this situation. 

What do you think about this?


Thanks,
Anton Pevtsov


Mime
View raw message