From ce53653ecdfa8531c1f238286a9debcb119e204b Mon Sep 17 00:00:00 2001 From: fourtf Date: Thu, 19 Sep 2019 12:19:50 +0200 Subject: [PATCH] remoed nullableptr --- src/ForwardDecl.hpp | 2 ++ src/nullableptr.h | 59 --------------------------------------------- 2 files changed, 2 insertions(+), 59 deletions(-) delete mode 100644 src/nullableptr.h diff --git a/src/ForwardDecl.hpp b/src/ForwardDecl.hpp index 2f4a42a5d..49e827ee3 100644 --- a/src/ForwardDecl.hpp +++ b/src/ForwardDecl.hpp @@ -1,5 +1,7 @@ #pragma once +// This file contains common forward declarations. + namespace chatterino { class Channel; class ChannelView; diff --git a/src/nullableptr.h b/src/nullableptr.h deleted file mode 100644 index 33f99a2ee..000000000 --- a/src/nullableptr.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -namespace chatterino { - -template -class NullablePtr -{ -public: - NullablePtr() - : element_(nullptr) - { - } - - NullablePtr(T *element) - : element_(element) - { - } - - T *operator->() const - { - assert(this->hasElement()); - - return element_; - } - - T &operator*() const - { - assert(this->hasElement()); - - return *element_; - } - - T *get() const - { - assert(this->hasElement()); - - return this->element_; - } - - bool isNull() const - { - return this->element_ == nullptr; - } - - bool hasElement() const - { - return this->element_ != nullptr; - } - - operator bool() const - { - return this->hasElement(); - } - -private: - T *element_; -}; - -} // namespace chatterino