From 3ff350cf96676f2c32c6913aceeabf84a15f3715 Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 25 Mar 2015 14:28:41 -0700 Subject: [PATCH] Make a fake version of nullptr to work with old compilers --- include/grpc++/config.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 35bf5073647..e10f00fb63c 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 +const class { +public: + template operator T*() const {return static_cast(0);} + template operator std::unique_ptr() const { + return std::unique_ptr(static_cast(0)); + } + operator bool() const {return false;} +private: + void operator&() const = delete; +} nullptr = {}; +#endif + namespace grpc { typedef GRPC_CUSTOM_STRING string;