Include <optional> if possible to check if we can use the feature

Addresses #303
This commit is contained in:
Nick Krichevsky 2021-10-05 10:56:58 -04:00
parent 5eca8a3001
commit 1bf360c037
No known key found for this signature in database
GPG Key ID: A7567E699BE5AAE4

View File

@ -51,9 +51,14 @@ THE SOFTWARE.
# include <regex>
#endif // CXXOPTS_NO_REGEX
#ifdef __cpp_lib_optional
#include <optional>
#define CXXOPTS_HAS_OPTIONAL
// Nonstandard before C++17, which is coincidentally what we also need for <optional>
#ifdef __has_include
# if __has_include(<optional>)
# include <optional>
# ifdef __cpp_lib_optional
# define CXXOPTS_HAS_OPTIONAL
# endif
# endif
#endif
#if __cplusplus >= 201603L
@ -1355,7 +1360,7 @@ namespace cxxopts
{
return m_count;
}
#if defined(CXXOPTS_NULL_DEREF_IGNORE)
#pragma GCC diagnostic pop
#endif