diff --git a/src/3rdparty/optional/optional.hpp b/src/3rdparty/optional/optional.hpp index fe1832b2ae..e22297c4c6 100644 --- a/src/3rdparty/optional/optional.hpp +++ b/src/3rdparty/optional/optional.hpp @@ -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 make_optional(reference_wrapper v) } -} // namespace experimental -} // namespace std +} // namespace ottd_optional namespace std { template - struct hash> + struct hash> { typedef typename hash::result_type result_type; - typedef std::experimental::optional argument_type; + typedef ottd_optional::optional argument_type; constexpr result_type operator()(argument_type const& arg) const { return arg ? std::hash{}(*arg) : result_type{}; @@ -1049,10 +1047,10 @@ namespace std }; template - struct hash> + struct hash> { typedef typename hash::result_type result_type; - typedef std::experimental::optional argument_type; + typedef ottd_optional::optional argument_type; constexpr result_type operator()(argument_type const& arg) const { return arg ? std::hash{}(*arg) : result_type{}; diff --git a/src/3rdparty/optional/ottd_optional.h b/src/3rdparty/optional/ottd_optional.h index 19b44c5055..a88703734c 100644 --- a/src/3rdparty/optional/ottd_optional.h +++ b/src/3rdparty/optional/ottd_optional.h @@ -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 @@ -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 diff --git a/src/fios.cpp b/src/fios.cpp index 4586f86b33..bf621f4d2d 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -20,7 +20,7 @@ #include "tar_type.h" #include #include -#include +#include "3rdparty/optional/ottd_optional.h" #ifndef _WIN32 # include @@ -495,7 +495,7 @@ FiosType FiosGetSavegameListCallback(SaveLoadOperation fop, const std::string &f */ void FiosGetSavegameList(SaveLoadOperation fop, FileList &file_list) { - static std::optional fios_save_path; + static opt::optional fios_save_path; if (!fios_save_path) fios_save_path = FioFindDirectory(SAVE_DIR); @@ -544,7 +544,7 @@ static FiosType FiosGetScenarioListCallback(SaveLoadOperation fop, const std::st */ void FiosGetScenarioList(SaveLoadOperation fop, FileList &file_list) { - static std::optional fios_scn_path; + static opt::optional fios_scn_path; /* Copy the default path on first run or on 'New Game' */ if (!fios_scn_path) fios_scn_path = FioFindDirectory(SCENARIO_DIR); @@ -606,7 +606,7 @@ static FiosType FiosGetHeightmapListCallback(SaveLoadOperation fop, const std::s */ void FiosGetHeightmapList(SaveLoadOperation fop, FileList &file_list) { - static std::optional fios_hmap_path; + static opt::optional fios_hmap_path; if (!fios_hmap_path) fios_hmap_path = FioFindDirectory(HEIGHTMAP_DIR); @@ -623,7 +623,7 @@ void FiosGetHeightmapList(SaveLoadOperation fop, FileList &file_list) */ const char *FiosGetScreenshotDir() { - static std::optional fios_screenshot_path; + static opt::optional fios_screenshot_path; if (!fios_screenshot_path) fios_screenshot_path = FioFindDirectory(SCREENSHOT_DIR);