|
Boost : |
From: Greg Chicares (chicares_at_[hidden])
Date: 2001-04-15 20:19:53
Jens Maurer wrote:
>
> Greg Chicares wrote:
>
> > Patch two: [edited for brevity]
> > + namespace std { class ios_base : public ios{}; }
>
> This is not good if it's repeated in several header files and
> thus multiple definitions of ios_base are encountered.
Thank you; I hadn't perceived that problem...yet.
> > Is this preferable to the workaround
> > std::istream::fmtflags f_; // old GNU c++ lib has no ios_base
> > in random.hpp?
>
> This work-around is entirely conformant with both old and new
> iostreams. Therefore, I believe this workaround (albeit a bit
> strange to the eye) is acceptable, and superior to messing around
> with defining ios_base. It's an implementation-level
> workaround anyway, so interfaces are not affected.
Then I propose the following changes:
*** boost/progress.hpp
- std::ios_base::fmtflags old_flags = _os.setf( std::ios_base::fixed,
- std::ios_base::floatfield );
+ // old GNU c++ lib has no ios_base
+ std::istream::fmtflags old_flags = _os.setf( std::istream::fixed,
+ std::istream::floatfield );
With this change (and use of <boost/limits.hpp> instead of <limits>
in timer.hpp as previously discussed), gcc-2.95.2 now passes the
timer test. The only other compiler I have to test with is borland
C++ 5.5; it still passes too.
*** libs/regex/src/cpp_regex_traits.cpp
[see attachment: run 'patch < diffs' to apply; tested with gnu patch 2.5]
The library builds with gcc-2.95.2 . I'm not sure how to run the
tests; I did build the 'r2' binary in libs/regex/demo/regress,
and running it gives
./r2 tests.txt
871 lines, 629 tests completed in file tests.txt
but I can't readily see how to interpret this.
*** libs/random/nondet_random.html
No change proposed. The language
The pseudo-device should never signal an error or end-of-file.
Otherwise, std::ios_base::failure is thrown.
^^^^^^^^
remains valid; how the 'failure' member is found for a nonconforming
compiler is an implementation detail that doesn't belong in the
html documentation.
*** /boost/boost_1_21_1x/libs/regex/src/cpp_regex_traits.cpp Wed Mar 14 11:11:56 2001
--- ./cpp_regex_traits.cpp Sun Apr 15 20:22:36 2001
***************
*** 89,94 ****
protected:
std::basic_streambuf<charT, traits>* setbuf(char_type* s, streamsize n);
! typename parser_buf<charT, traits>::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which);
! typename parser_buf<charT, traits>::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which);
private:
parser_buf& operator=(const parser_buf&);
--- 89,94 ----
protected:
std::basic_streambuf<charT, traits>* setbuf(char_type* s, streamsize n);
! typename parser_buf<charT, traits>::pos_type seekpos(pos_type sp, ::std::istream::openmode which);
! typename parser_buf<charT, traits>::pos_type seekoff(off_type off, ::std::istream::seekdir way, ::std::istream::openmode which);
private:
parser_buf& operator=(const parser_buf&);
***************
*** 106,112 ****
template<class charT, class traits>
typename parser_buf<charT, traits>::pos_type
! parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which)
{
! if(which & ::std::ios_base::out)
return pos_type(off_type(-1));
int size = this->egptr() - this->eback();
--- 106,112 ----
template<class charT, class traits>
typename parser_buf<charT, traits>::pos_type
! parser_buf<charT, traits>::seekoff(off_type off, ::std::istream::seekdir way, ::std::istream::openmode which)
{
! if(which & ::std::istream::out)
return pos_type(off_type(-1));
int size = this->egptr() - this->eback();
***************
*** 115,129 ****
switch(way)
{
! case ::std::ios_base::beg:
if((off < 0) || (off > size))
return pos_type(off_type(-1));
else
this->setg(g, g + off, g + size);
! case ::std::ios_base::end:
if((off < 0) || (off > size))
return pos_type(off_type(-1));
else
this->setg(g, g + size - off, g + size);
! case ::std::ios_base::cur:
{
int newpos = pos + off;
--- 115,129 ----
switch(way)
{
! case ::std::istream::beg:
if((off < 0) || (off > size))
return pos_type(off_type(-1));
else
this->setg(g, g + off, g + size);
! case ::std::istream::end:
if((off < 0) || (off > size))
return pos_type(off_type(-1));
else
this->setg(g, g + size - off, g + size);
! case ::std::istream::cur:
{
int newpos = pos + off;
***************
*** 139,145 ****
template<class charT, class traits>
typename parser_buf<charT, traits>::pos_type
! parser_buf<charT, traits>::seekpos(pos_type sp, ::std::ios_base::openmode which)
{
! if(which & ::std::ios_base::out)
return pos_type(off_type(-1));
int size = this->egptr() - this->eback();
--- 139,145 ----
template<class charT, class traits>
typename parser_buf<charT, traits>::pos_type
! parser_buf<charT, traits>::seekpos(pos_type sp, ::std::istream::openmode which)
{
! if(which & ::std::istream::out)
return pos_type(off_type(-1));
int size = this->egptr() - this->eback();
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk