mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
constexpr operators
This commit is contained in:
parent
0535138459
commit
3c017bfa10
@ -101,7 +101,7 @@ public:
|
||||
not_null(std::nullptr_t) = delete;
|
||||
not_null(int) = delete;
|
||||
not_null<T>& operator=(std::nullptr_t) = delete;
|
||||
not_null<T>& operator=(int) = delete;
|
||||
not_null<T>& operator=(int) = delete;
|
||||
|
||||
T get() const {
|
||||
#ifdef _MSC_VER
|
||||
@ -110,11 +110,16 @@ public:
|
||||
return ptr_;
|
||||
} // the assume() should help the optimizer
|
||||
|
||||
operator T() const { return get(); }
|
||||
operator T() const { return get(); }
|
||||
T operator->() const { return get(); }
|
||||
|
||||
bool operator==(const T& rhs) const { return ptr_ == rhs; }
|
||||
bool operator!=(const T& rhs) const { return !(*this == rhs); }
|
||||
bool operator==(const T& rhs) const { return ptr_ == rhs; }
|
||||
bool operator!=(const T& rhs) const { return !(*this == rhs); }
|
||||
|
||||
constexpr bool operator==(std::nullptr_t) const { return false; }
|
||||
constexpr bool operator!=(std::nullptr_t) const { return true; }
|
||||
|
||||
constexpr operator bool() const { return true; }
|
||||
private:
|
||||
T ptr_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user