From 56a4dc5d4c53e99b743c2b57d5b24df430802c4d Mon Sep 17 00:00:00 2001
From: Christian Engwer <christi@dune-project.org>
Date: Mon, 1 Feb 2010 12:42:57 +0000
Subject: [PATCH] * fix nullptr with gcc 3.4

merge to release

[[Imported from SVN: r5875]]
---
 dune/common/nullptr.hh           | 12 ++++++++++++
 dune/common/test/nullptr-test.cc |  1 +
 2 files changed, 13 insertions(+)

diff --git a/dune/common/nullptr.hh b/dune/common/nullptr.hh
index e75000ed2..9f07c05cf 100644
--- a/dune/common/nullptr.hh
+++ b/dune/common/nullptr.hh
@@ -26,6 +26,18 @@ private:
 
 typedef dune_nullptr_t nullptr_t;
 
+template<class T>
+bool operator == (T* t, dune_nullptr_t)
+{
+  return (t == static_cast<T*>(nullptr));
+}
+
+template<class T>
+bool operator == (dune_nullptr_t, T* t)
+{
+  return (t == static_cast<T*>(nullptr));
+}
+
 #endif // HAVE_NULLPTR
 
 #endif // DUNE_NULLPTR_HH
diff --git a/dune/common/test/nullptr-test.cc b/dune/common/test/nullptr-test.cc
index 26e539d5a..e323e56dc 100644
--- a/dune/common/test/nullptr-test.cc
+++ b/dune/common/test/nullptr-test.cc
@@ -17,6 +17,7 @@ void basic_tests()
   int n2 = 0;            // n2 is zero
   if( ch == 0 ) ;        // evaluates to true
   if( ch == nullptr ) ;  // evaluates to true
+  if( nullptr == ch ) ;  // evaluates to true
   if( ch ) ;             // evaluates to false
   if( n2 == 0 ) ;        // evaluates to true
   ch = ch2;
-- 
GitLab