Use Boost Optional if SOL_USE_BOOST is defined

Usecase: Project already uses Boost as dependency, your compiler doesn't
come with <optional> yet and you want to minimize further dependencies.
This commit is contained in:
Georg Sauthoff 2016-05-27 09:15:28 +02:00
parent 9b65fb9f93
commit 250661b780

View File

@ -24,6 +24,8 @@
#if __cplusplus > 201402L
#include <optional>
#elif defined(SOL_USE_BOOST)
#include <boost/optional.hpp>
#else
#include "../Optional/optional.hpp"
#endif // C++ 14
@ -35,6 +37,11 @@ template <typename T>
using optional = sol::optional<T>;
using nullopt_t = std::nullopt_t;
constexpr nullopt_t nullopt = std::nullopt;
#elif defined(SOL_USE_BOOST)
template <typename T>
using optional = boost::optional<T>;
using nullopt_t = boost::none_t;
const nullopt_t nullopt = boost::none;
#else
#endif // C++ 14
}