From 1a791992a0bc4b86bedd55768da9585ad9c08e70 Mon Sep 17 00:00:00 2001 From: Treb Connell Date: Fri, 25 Sep 2015 12:16:39 -0700 Subject: [PATCH] Add equality operators to maybe_nul_ret --- include/gsl.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/gsl.h b/include/gsl.h index b78c6e2..009c777 100644 --- a/include/gsl.h +++ b/include/gsl.h @@ -267,6 +267,9 @@ public: maybe_null_ret& operator=(const T& p) { if (ptr_ != p) { ptr_ = p; } return *this; } maybe_null_ret& operator=(const maybe_null_ret& rhs) = default; + bool operator==(const T& rhs) const { return ptr_ == rhs; } + bool operator!=(const T& rhs) const { return ptr_ != rhs; } + bool present() const { return ptr_ != nullptr; } T get() const { return ptr_; }