From: Wolfgang Bangerth Date: Wed, 26 Sep 2007 15:12:29 +0000 (+0000) Subject: Undo the last patch: we don't need anything to be mutable here at all since we don... X-Git-Tag: v8.0.0~9817 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a193ae4ae27ad73c6637781dfd8ab552f91e7969;p=dealii.git Undo the last patch: we don't need anything to be mutable here at all since we don't modify the variable -- only the object the reference points to. constness isn't inherited from member functions to the pointed to object. git-svn-id: https://svn.dealii.org/trunk@15247 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/conditional_ostream.h b/deal.II/base/include/base/conditional_ostream.h index e6e935b441..0e1ff0d505 100644 --- a/deal.II/base/include/base/conditional_ostream.h +++ b/deal.II/base/include/base/conditional_ostream.h @@ -141,23 +141,10 @@ class ConditionalOStream private: /** - * Pointer to cout. This - * class could easily be extended - * to treat streams different - * to the standard output. - * - * This variable must be @p mutable so - * that we can write to it in above @p - * const @p operator<< functions. For the - * reason why they, in turn, need to be - * @p const, see there. - * - * Now, we would like to make the - * variable a reference, but then the C++ - * standard says that 'mutable' can't be - * applied to reference members. + * Reference to the stream we + * want to write to. */ - mutable std::ostream *output_stream; + std::ostream &output_stream; /** * Stores the actual condition @@ -175,7 +162,7 @@ const ConditionalOStream & ConditionalOStream::operator<< (const T& t) const { if (active_flag == true) - *output_stream << t; + output_stream << t; return *this; } @@ -186,7 +173,7 @@ const ConditionalOStream & ConditionalOStream::operator<< (std::ostream& (*p) (std::ostream&)) const { if (active_flag == true) - *output_stream << p; + output_stream << p; return *this; } diff --git a/deal.II/base/source/conditional_ostream.cc b/deal.II/base/source/conditional_ostream.cc index 82410cc0c0..e5862f7f9b 100644 --- a/deal.II/base/source/conditional_ostream.cc +++ b/deal.II/base/source/conditional_ostream.cc @@ -18,7 +18,7 @@ DEAL_II_NAMESPACE_OPEN ConditionalOStream::ConditionalOStream(std::ostream &stream, const bool active) : - output_stream (&stream), + output_stream (stream), active_flag(active) {}