From 3a3c81aaaf035bd578c30ed37aba7875fed6765a Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Tue, 3 Jan 2017 21:43:40 +0100 Subject: [PATCH] make nullable portable Change-Id: I00c8e8b8b8d1d32bc52035528ebf7a504effb33e --- qtbase/include/nullable.h | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/qtbase/include/nullable.h b/qtbase/include/nullable.h index b246cc0..86bcae4 100644 --- a/qtbase/include/nullable.h +++ b/qtbase/include/nullable.h @@ -11,6 +11,8 @@ #define WOLF_BASE_EXPORT Q_DECL_IMPORT #endif +#include + ///special class for Null values ///this was a legacy class before nullptr was introduced, use nullptr now! class WOLF_BASE_EXPORT NullValue @@ -18,15 +20,15 @@ class WOLF_BASE_EXPORT NullValue public: NullValue(){} NullValue(const NullValue&){} - NullValue(const nullptr_t&){} + NullValue(const std::nullptr_t&){} // operator void*()const{return (void*)0;} template operator T*()const{return (T*)nullptr;} bool operator==(const NullValue&)const{return true;} bool operator!=(const NullValue&)const{return false;} - bool operator==(const nullptr_t&)const{return true;} - bool operator!=(const nullptr_t&)const{return false;} + bool operator==(const std::nullptr_t&)const{return true;} + bool operator!=(const std::nullptr_t&)const{return false;} templatebool operator==(const T*p)const{return p==nullptr;} templatebool operator!=(const T*p)const{return p!=nullptr;} @@ -45,7 +47,7 @@ templateclass WOLF_BASE_EXPORT Nullable Nullable(const NullValue&):isnull(true),elem(){} /**creates a NULL value*/ //TODO: find an implementation that works without auto-casting 0 to nullptr while not using explicit - explicit Nullable(const nullptr_t&):isnull(true),elem(){} + explicit Nullable(const std::nullptr_t&):isnull(true),elem(){} /**creates a wrapped non-NULL value that is equivalent to the original*/ Nullable(const T&t):isnull(false),elem(t){} /**copies a nullable value*/ @@ -101,9 +103,9 @@ templateclass WOLF_BASE_EXPORT Nullable ///compares the Nullable with the special null value bool operator!=(const NullValue&)const{return !isnull;} ///compares the Nullable with the special null value - bool operator==(const nullptr_t&)const{return isnull;} + bool operator==(const std::nullptr_t&)const{return isnull;} ///compares the Nullable with the special null value - bool operator!=(const nullptr_t&)const{return !isnull;} + bool operator!=(const std::nullptr_t&)const{return !isnull;} private: bool isnull; T elem; -- 1.7.2.5