Skip to content

Commit

Permalink
cxxopts as_optional fixup (#422)
Browse files Browse the repository at this point in the history
Co-authored-by: Nigel Stewart <[email protected]>
  • Loading branch information
nigels-com and Nigel Stewart authored Mar 8, 2024
1 parent 70fb4e4 commit 3d9a4c0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/cxxopts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,9 @@ CXXOPTS_DIAGNOSTIC_POP
std::optional<T>
as_optional() const
{
if (m_value == nullptr) {
return std::nullopt;
}
return as<T>();
}
#endif
Expand Down

0 comments on commit 3d9a4c0

Please sign in to comment.