@@ -47,15 +47,9 @@ struct Nullable : protected std::optional<T>
47
47
using std::optional<T>::optional;
48
48
using std::optional<T>::value_or;
49
49
using std::optional<T>::value;
50
- using std::optional<T>::has_value;
51
50
using std::optional<T>::operator *;
52
51
using std::optional<T>::operator ->;
53
52
54
- // backwards compatibiltiyt with old chip::Optional functionality
55
- // NOTE: as we transition to std::optional, these should be removed
56
- T & Value () & { return value (); }
57
- const T & Value () const & { return value (); }
58
- const T & ValueOr (const T & defaultValue) const { return value_or (defaultValue); }
59
53
Nullable (NullOptionalType) : std::optional<T>(std::nullopt) {}
60
54
61
55
// Some consumers need an easy way to determine our underlying type.
@@ -106,15 +100,23 @@ struct Nullable : protected std::optional<T>
106
100
107
101
bool operator ==(const Nullable<T> & other) const
108
102
{
109
- if (!has_value ())
103
+ if (!std::optional<T>:: has_value ())
110
104
{
111
105
return !other.has_value ();
112
106
}
113
107
return other.has_value () && (*other == **this );
114
108
}
115
109
bool operator !=(const Nullable<T> & other) const { return !(*this == other); }
116
- bool operator ==(const T & other) const { return has_value () && (**this == other); }
117
- bool operator !=(const T & other) const { return !has_value () || (**this != other); }
110
+ bool operator ==(const T & other) const { return std::optional<T>::has_value () && (**this == other); }
111
+ bool operator !=(const T & other) const { return !(*this == other); }
112
+
113
+ // backwards compatibiltiyt with old chip::Optional functionality
114
+ // NOTE: as we transition to std::optional, these should be removed
115
+ // We expect only `value` and `value_or` to remain.
116
+ T & Value () & { return value (); }
117
+ const T & Value () const & { return value (); }
118
+ const T & ValueOr (const T & defaultValue) const { return value_or (defaultValue); }
119
+
118
120
};
119
121
120
122
template <class T >
0 commit comments