Add equality operators to maybe_nul_ret

This commit is contained in:
Treb Connell 2015-09-25 12:16:39 -07:00
parent 35fb11853f
commit 1a791992a0

View File

@ -267,6 +267,9 @@ public:
maybe_null_ret& operator=(const T& p) { if (ptr_ != p) { ptr_ = p; } return *this; } maybe_null_ret& operator=(const T& p) { if (ptr_ != p) { ptr_ = p; } return *this; }
maybe_null_ret& operator=(const maybe_null_ret& rhs) = default; 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; } bool present() const { return ptr_ != nullptr; }
T get() const { return ptr_; } T get() const { return ptr_; }