aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/config.h
diff options
context:
space:
mode:
authorGravatar vjpai <vpai@google.com>2015-03-25 14:28:41 -0700
committerGravatar vjpai <vpai@google.com>2015-03-25 14:28:41 -0700
commit3ff350cf96676f2c32c6913aceeabf84a15f3715 (patch)
treeb687e45c807eb1d8f1d5ea9f6abcc148d77adb76 /include/grpc++/config.h
parente98b1cc3565b28ea8df0946a2cd25d63a77e0fdc (diff)
Make a fake version of nullptr to work with old compilers
Diffstat (limited to 'include/grpc++/config.h')
-rw-r--r--include/grpc++/config.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/grpc++/config.h b/include/grpc++/config.h
index 35bf507364..e10f00fb63 100644
--- a/include/grpc++/config.h
+++ b/include/grpc++/config.h
@@ -65,6 +65,26 @@
::google::protobuf::io::ZeroCopyInputStream
#endif
+#ifdef __GNUC__
+#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406)
+#define GRPC_NO_NULLPTR
+#endif
+#endif
+
+#ifdef GRPC_NO_NULLPTR
+#include <memory>
+const class {
+public:
+ template <class T> operator T*() const {return static_cast<T *>(0);}
+ template <class T> operator std::unique_ptr<T>() const {
+ return std::unique_ptr<T>(static_cast<T *>(0));
+ }
+ operator bool() const {return false;}
+private:
+ void operator&() const = delete;
+} nullptr = {};
+#endif
+
namespace grpc {
typedef GRPC_CUSTOM_STRING string;