Skip to content
Snippets Groups Projects
Commit 7a3a5456 authored by Christian Engwer's avatar Christian Engwer
Browse files

make nullptr play nicely with g++4.6

* update configure check
* move nullptr_t to namespace Dune
* import nullptr_t from namespace std (according to updated proposal)

[[Imported from SVN: r6492]]
parent 17d019de
Branches
Tags
No related merge requests found
......@@ -28,7 +28,9 @@ private:
void operator&() const; // whose address can't be taken
} nullptr = {}; // and whose name is nullptr
typedef dune_nullptr_t nullptr_t;
namespace Dune {
typedef dune_nullptr_t nullptr_t;
}
template<class T>
bool operator == (T* t, dune_nullptr_t)
......@@ -42,6 +44,14 @@ bool operator == (dune_nullptr_t, T* t)
return (t == static_cast<T*>(nullptr));
}
#else
#include <cstddef>
namespace Dune {
using std::nullptr_t;
}
#endif // HAVE_NULLPTR
#endif // DUNE_NULLPTR_HH
......@@ -8,7 +8,7 @@
void basic_tests()
{
typedef nullptr_t NULLPTR_T;
typedef Dune::nullptr_t NULLPTR_T;
char* ch = nullptr; // ch has the null pointer value
char* ch2 = 0; // ch2 has the null pointer value
#ifdef FAIL
......
......@@ -3,7 +3,7 @@ AC_DEFUN([NULLPTR_CHECK],[
AC_REQUIRE([GXX0X])
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([whether nullptr is supported])
AC_TRY_COMPILE([],[typedef nullptr_t peng;
AC_TRY_COMPILE([],[
char* ch = nullptr;
], [
HAVE_NULLPTR=yes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment