From 4a4f9781c61c1a717bc243cfe7543c52f4556944 Mon Sep 17 00:00:00 2001 From: Christian Engwer <christi@dune-project.org> Date: Fri, 12 Mar 2010 07:47:50 +0000 Subject: [PATCH] fix io problems with certain compilers (I think this was gcc-3.4) by moving the definition of operator << outside the class declaration. [[Imported from SVN: r5925]] --- dune/common/geometrytype.hh | 75 +++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/dune/common/geometrytype.hh b/dune/common/geometrytype.hh index b00ce6d14..c7c22974f 100644 --- a/dune/common/geometrytype.hh +++ b/dune/common/geometrytype.hh @@ -162,44 +162,55 @@ namespace Dune { return basicType_ < other.basicType_; } - /** \brief Prints the type to an output stream */ - friend std::ostream& operator<< (std::ostream& s, const GeometryType& a) - { - switch (a.basicType_) { - case simplex : - s << "(simplex, " << a.dim_ << ")"; - break; - case cube : - s << "(cube, " << a.dim_ << ")"; - break; - case pyramid : - s << "pyramid"; - break; - case prism : - s << "prism"; - break; - case none : - s << "(none, " << a.dim_ << ")"; - break; - default : - s << "invalid geometry type"; - } - - return s; - } - + friend inline std::ostream& operator<< (std::ostream& s, const GeometryType& a); }; + /** \brief Prints the type to an output stream */ + inline std::ostream& operator<< (std::ostream& s, const GeometryType& a) + { + switch (a.basicType_) { + case GeometryType::simplex : + s << "(simplex, " << a.dim_ << ")"; + break; + case GeometryType::cube : + s << "(cube, " << a.dim_ << ")"; + break; + case GeometryType::pyramid : + s << "pyramid"; + break; + case GeometryType::prism : + s << "prism"; + break; + case GeometryType::none : + s << "(none, " << a.dim_ << ")"; + break; + default : + s << "invalid geometry type"; + } + return s; + } + /** \brief Prints a GeometryType::BasicType to an output stream */ inline std::ostream& operator<< (std::ostream& s, GeometryType::BasicType type) { switch (type) { - case GeometryType::simplex : s << "simplex"; break; - case GeometryType::cube : s << "cube"; break; - case GeometryType::pyramid : s << "pyramid"; break; - case GeometryType::prism : s << "prism"; break; - case GeometryType::none : s << "none"; break; - default : s << "[unknown GeometryType::BasicType: " << int(type) << "]"; + case GeometryType::simplex : + s << "simplex"; + break; + case GeometryType::cube : + s << "cube"; + break; + case GeometryType::pyramid : + s << "pyramid"; + break; + case GeometryType::prism : + s << "prism"; + break; + case GeometryType::none : + s << "none"; + break; + default : + s << "[unknown GeometryType::BasicType: " << int(type) << "]"; } return s; } -- GitLab