Extend simgear::Optional with value_or

Needed to allow parity with C++17 use on next
This commit is contained in:
Automatic Release Builder 2022-02-03 12:52:58 +00:00
parent af0f7676c4
commit e5bef3f97f

View File

@ -74,6 +74,22 @@ public:
return _value; return _value;
} }
const T& value_or(const T& defaultValue) const
{
if (!_haveValue) {
return defaultValue;
}
return _value;
}
T& value_or(T& defaultValue) const
{
if (!_haveValue) {
return defaultValue;
}
return _value;
}
T& value() T& value()
{ {
if (!_haveValue) { if (!_haveValue) {