From 250661b780e4aab528b428c8c7d80d45c44ff600 Mon Sep 17 00:00:00 2001 From: Georg Sauthoff Date: Fri, 27 May 2016 09:15:28 +0200 Subject: [PATCH] Use Boost Optional if SOL_USE_BOOST is defined Usecase: Project already uses Boost as dependency, your compiler doesn't come with yet and you want to minimize further dependencies. --- sol/optional.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sol/optional.hpp b/sol/optional.hpp index ff28ce91..8fd6cc3a 100644 --- a/sol/optional.hpp +++ b/sol/optional.hpp @@ -24,6 +24,8 @@ #if __cplusplus > 201402L #include +#elif defined(SOL_USE_BOOST) +#include #else #include "../Optional/optional.hpp" #endif // C++ 14 @@ -35,6 +37,11 @@ template using optional = sol::optional; using nullopt_t = std::nullopt_t; constexpr nullopt_t nullopt = std::nullopt; +#elif defined(SOL_USE_BOOST) +template +using optional = boost::optional; +using nullopt_t = boost::none_t; +const nullopt_t nullopt = boost::none; #else #endif // C++ 14 }