From dfb3d0fe53c0c8c5e5f3145de55604972201ff06 Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 13 Mar 2002 10:06:36 +0000 Subject: [PATCH] only use std::ends when necessary, i.e. for the old strstream classes. git-svn-id: https://svn.dealii.org/trunk@5565 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/exceptions.cc | 6 ++++-- deal.II/base/source/log.cc | 5 ++++- deal.II/base/source/parameter_handler.cc | 12 ++++++++---- deal.II/base/source/table_handler.cc | 4 +++- deal.II/deal.II/source/numerics/data_out.cc | 5 ++++- deal.II/doc/news/2002/c-3-3.html | 11 +++++++++++ deal.II/examples/step-5/step-5.cc | 13 +++++++++---- deal.II/lac/source/solver_control.cc | 5 ++++- 8 files changed, 47 insertions(+), 14 deletions(-) diff --git a/deal.II/base/source/exceptions.cc b/deal.II/base/source/exceptions.cc index c7f34ce36c..fc4a4bb4b8 100644 --- a/deal.II/base/source/exceptions.cc +++ b/deal.II/base/source/exceptions.cc @@ -113,8 +113,10 @@ const char * ExceptionBase::what () const throw () PrintInfo (converter); converter << "--------------------------------------------------------" - << std::endl - << std::ends; + << std::endl; +#ifndef HAVE_STD_STRINGSTREAM + converter << std::ends; +#endif description = converter.str(); diff --git a/deal.II/base/source/log.cc b/deal.II/base/source/log.cc index 38f40be604..927eb94550 100644 --- a/deal.II/base/source/log.cc +++ b/deal.II/base/source/log.cc @@ -170,7 +170,10 @@ LogStream::print_line_head() std::ostrstream statname; #endif - statname << "/proc/" << id << "/stat" << std::ends; + statname << "/proc/" << id << "/stat"; +#ifndef HAVE_STD_STRINGSTREAM + statname << std::ends; +#endif static long size; static string dummy; ifstream stat(statname.str()); diff --git a/deal.II/base/source/parameter_handler.cc b/deal.II/base/source/parameter_handler.cc index 06d3456192..0c5db04b58 100644 --- a/deal.II/base/source/parameter_handler.cc +++ b/deal.II/base/source/parameter_handler.cc @@ -123,8 +123,10 @@ namespace Patterns description << "[Integer range " << lower_bound << "..." << upper_bound - << " (inclusive)]" - << std::ends; + << " (inclusive)]"; +#ifndef HAVE_STD_STRINGSTREAM + description << std::ends; +#endif return description.str(); } else @@ -205,8 +207,10 @@ namespace Patterns description << "[Floating point range " << lower_bound << "..." << upper_bound - << " (inclusive)]" - << std::ends; + << " (inclusive)]"; +#ifndef HAVE_STD_STRINGSTREAM + description << std::ends; +#endif return description.str(); } else diff --git a/deal.II/base/source/table_handler.cc b/deal.II/base/source/table_handler.cc index c70e6d6762..fe6451631b 100644 --- a/deal.II/base/source/table_handler.cc +++ b/deal.II/base/source/table_handler.cc @@ -254,8 +254,10 @@ void TableHandler::write_text(std::ostream &out) const else dummy_out.setf (std::ios::fixed, std::ios::floatfield); column.entries[i]->write_text (dummy_out); +#ifndef HAVE_STD_STRINGSTREAM dummy_out << std::ends; - +#endif + // get size, note that we are // not interested in the // trailing \0 diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index 4d943bfdac..b000032938 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -213,7 +213,10 @@ add_data_vector (const VECTOR &vec, #else std::ostrstream namebuf; #endif - namebuf << '_' << i << std::ends; + namebuf << '_' << i; +#ifndef HAVE_STD_STRINGSTREAM + namebuf << std::ends; +#endif names[i] = name + namebuf.str(); }; }; diff --git a/deal.II/doc/news/2002/c-3-3.html b/deal.II/doc/news/2002/c-3-3.html index 9c5eeb5b0d..534e64b95b 100644 --- a/deal.II/doc/news/2002/c-3-3.html +++ b/deal.II/doc/news/2002/c-3-3.html @@ -33,6 +33,17 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK

General

    +
  1. + Fixed: For gcc versions that used ostrstream instead of ostringstream, it was necessary to append + a final std::ends when piping text + into the string stream. This was not previously + conditionalized, but done for old and new classes. +
    + (WB 2002/03/13) +

    +
  2. Changed: The configure machinery has been revamped significantly. diff --git a/deal.II/examples/step-5/step-5.cc b/deal.II/examples/step-5/step-5.cc index a244c6f713..e8c2388d2d 100644 --- a/deal.II/examples/step-5/step-5.cc +++ b/deal.II/examples/step-5/step-5.cc @@ -837,11 +837,16 @@ void LaplaceProblem::output_results (const unsigned int cycle) const filename << "solution-" << cycle << ".eps"; - // In order to append the final - // '\0', we have to put an ``ends'' - // to the end of the string: - filename << std::ends; + // For the old string stream + // classes, we have to append the + // final '\0' that appears at the + // end of ``char *'' + // variables. This is done by the + // following construct: +#ifndef HAVE_STD_STRINGSTREAM + filename << std::ends; +#endif // We can get whatever we wrote to // the stream using the ``str()'' // function. If the new diff --git a/deal.II/lac/source/solver_control.cc b/deal.II/lac/source/solver_control.cc index 4208132d75..7d49e00e4e 100644 --- a/deal.II/lac/source/solver_control.cc +++ b/deal.II/lac/source/solver_control.cc @@ -59,7 +59,10 @@ SolverControl::NoConvergence::what () const throw () #endif out << "Iterative method reported convergence failure in step " - << last_step << " with residual " << last_residual << std::ends; + << last_step << " with residual " << last_residual; +#ifndef HAVE_STD_STRINGSTREAM + out << std::ends; +#endif description = out.str(); return description.c_str(); -- 2.39.5