From 74bff27f8602c3a4908200b158130ef80bd2a749 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Thu, 25 Dec 2014 22:17:44 +0300 Subject: [PATCH] Use experimental/optional if available --- SDL2pp/Optional.hh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/SDL2pp/Optional.hh b/SDL2pp/Optional.hh index 3c647c8..137afd0 100644 --- a/SDL2pp/Optional.hh +++ b/SDL2pp/Optional.hh @@ -22,6 +22,25 @@ #ifndef SDL2PP_OPTIONAL_HH #define SDL2PP_OPTIONAL_HH +#include + +#if defined(SDL2PP_WITH_EXPERIMENTAL_OPTIONAL) + +#include + +namespace SDL2pp { + +template +using Optional = std::experimental::optional; + +using BadOptionalAccess = std::experimental::bad_optional_access; + +constexpr std::experimental::nullopt_t NullOpt = std::experimental::nullopt; + +} + +#else + #include namespace SDL2pp { @@ -36,3 +55,5 @@ constexpr sdl2pp_libcpp_optional::nullopt_t NullOpt = sdl2pp_libcpp_optional::nu } #endif + +#endif