Skip to content

Commit bc029ad

Browse files
committed
Review updates
1 parent 48635c4 commit bc029ad

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/app/data-model/Nullable.h

+11-9
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,9 @@ struct Nullable : protected std::optional<T>
4747
using std::optional<T>::optional;
4848
using std::optional<T>::value_or;
4949
using std::optional<T>::value;
50-
using std::optional<T>::has_value;
5150
using std::optional<T>::operator*;
5251
using std::optional<T>::operator->;
5352

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); }
5953
Nullable(NullOptionalType) : std::optional<T>(std::nullopt) {}
6054

6155
// Some consumers need an easy way to determine our underlying type.
@@ -106,15 +100,23 @@ struct Nullable : protected std::optional<T>
106100

107101
bool operator==(const Nullable<T> & other) const
108102
{
109-
if (!has_value())
103+
if (!std::optional<T>::has_value())
110104
{
111105
return !other.has_value();
112106
}
113107
return other.has_value() && (*other == **this);
114108
}
115109
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+
118120
};
119121

120122
template <class T>

0 commit comments

Comments
 (0)