From: bangerth Date: Wed, 26 Sep 2007 03:16:28 +0000 (+0000) Subject: The C++ standard says that 'mutable' can't be applied to reference members, so change... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b915e7a77e8adba8e9359e9ca0c02fa345f94f8;p=dealii-svn.git The C++ standard says that 'mutable' can't be applied to reference members, so change things to a pointer instead. git-svn-id: https://svn.dealii.org/trunk@15240 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 398e79c3ac..e6e935b441 100644 --- a/deal.II/base/include/base/conditional_ostream.h +++ b/deal.II/base/include/base/conditional_ostream.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -151,8 +151,13 @@ class ConditionalOStream * 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. */ - mutable std::ostream &output_stream; + mutable std::ostream *output_stream; /** * Stores the actual condition @@ -170,7 +175,7 @@ const ConditionalOStream & ConditionalOStream::operator<< (const T& t) const { if (active_flag == true) - output_stream << t; + *output_stream << t; return *this; } @@ -181,7 +186,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 3168ecb7da..82410cc0c0 100644 --- a/deal.II/base/source/conditional_ostream.cc +++ b/deal.II/base/source/conditional_ostream.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -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) {}