mirror of
https://github.com/jarro2783/cxxopts.git
synced 2026-01-18 01:11:24 +01:00
cxxopts as_optional fixup (#422)
Co-authored-by: Nigel Stewart <nigel.stewart@emesent.io>
This commit is contained in:
@@ -1543,6 +1543,9 @@ CXXOPTS_DIAGNOSTIC_POP
|
||||
std::optional<T>
|
||||
as_optional() const
|
||||
{
|
||||
if (m_value == nullptr) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return as<T>();
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user