nullptr.hh
Go to the documentation of this file.00001 #ifndef DUNE_NULLPTR_HH
00002 #define DUNE_NULLPTR_HH
00003
00004 #if ! HAVE_NULLPTR
00005
00012 const
00013 class dune_nullptr_t {
00014 public:
00015 template<class T>
00016 operator T*() const
00017 { return 0; }
00018 template<class C, class T>
00019 operator T C::*() const
00020 { return 0; }
00021 private:
00022 void operator&() const;
00023 } nullptr = {};
00024
00025 typedef dune_nullptr_t nullptr_t;
00026
00027 template<class T>
00028 bool operator == (T* t, dune_nullptr_t)
00029 {
00030 return (t == static_cast<T*>(nullptr));
00031 }
00032
00033 template<class T>
00034 bool operator == (dune_nullptr_t, T* t)
00035 {
00036 return (t == static_cast<T*>(nullptr));
00037 }
00038
00039 #endif // HAVE_NULLPTR
00040
00041 #endif // DUNE_NULLPTR_HH