mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
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:
parent
9b65fb9f93
commit
250661b780
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user