Use 3rd party optional wrapper, always use local verison on Apple
This commit is contained in:
16
src/3rdparty/optional/optional.hpp
vendored
16
src/3rdparty/optional/optional.hpp
vendored
@@ -97,9 +97,8 @@
|
||||
# define OPTIONAL_MUTABLE_CONSTEXPR constexpr
|
||||
# endif
|
||||
|
||||
namespace std{
|
||||
|
||||
namespace experimental{
|
||||
namespace ottd_optional{
|
||||
using namespace std;
|
||||
|
||||
// BEGIN workaround for missing is_trivially_destructible
|
||||
# if defined TR2_OPTIONAL_GCC_4_8_AND_HIGHER___
|
||||
@@ -1032,16 +1031,15 @@ constexpr optional<X&> make_optional(reference_wrapper<X> v)
|
||||
}
|
||||
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
} // namespace ottd_optional
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <typename T>
|
||||
struct hash<std::experimental::optional<T>>
|
||||
struct hash<ottd_optional::optional<T>>
|
||||
{
|
||||
typedef typename hash<T>::result_type result_type;
|
||||
typedef std::experimental::optional<T> argument_type;
|
||||
typedef ottd_optional::optional<T> argument_type;
|
||||
|
||||
constexpr result_type operator()(argument_type const& arg) const {
|
||||
return arg ? std::hash<T>{}(*arg) : result_type{};
|
||||
@@ -1049,10 +1047,10 @@ namespace std
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct hash<std::experimental::optional<T&>>
|
||||
struct hash<ottd_optional::optional<T&>>
|
||||
{
|
||||
typedef typename hash<T>::result_type result_type;
|
||||
typedef std::experimental::optional<T&> argument_type;
|
||||
typedef ottd_optional::optional<T&> argument_type;
|
||||
|
||||
constexpr result_type operator()(argument_type const& arg) const {
|
||||
return arg ? std::hash<T>{}(*arg) : result_type{};
|
||||
|
4
src/3rdparty/optional/ottd_optional.h
vendored
4
src/3rdparty/optional/ottd_optional.h
vendored
@@ -16,7 +16,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (__cplusplus >= 201703L) || (defined(__cpp_lib_optional) && __cpp_lib_optional >= 201606L)
|
||||
#if !defined(__APPLE__) && ((__cplusplus >= 201703L) || (defined(__cpp_lib_optional) && __cpp_lib_optional >= 201606L))
|
||||
|
||||
/* Native std::optional. */
|
||||
#include <optional>
|
||||
@@ -26,7 +26,7 @@ namespace opt = std;
|
||||
|
||||
/* No std::optional, use local copy instead. */
|
||||
#include "optional.hpp"
|
||||
namespace opt = std::experimental;
|
||||
namespace opt = ottd_optional;
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user