diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index 3d73b0ca..4c7a244e 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -150,11 +150,7 @@ #if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1)) #define STD_THREAD_NOT_SUPPORTED #endif -#if 0 - #if (__GNUC_MINOR__ < 9) - #define _enable_std_make_unique - #endif -#endif + #if defined(NANA_MINGW) #ifndef __MINGW64_VERSION_MAJOR //It's a knonwn issue under MinGW(except MinGW-W64) @@ -183,30 +179,23 @@ # endif #endif -#include -//Detects std::make_unique -#if (!defined(_MSC_VER)) && (__cplusplus >= 201300) -# if !defined(__cpp_lib_make_unique) || (__cpp_lib_make_unique != 201304) -# ifndef _enable_std_make_unique -# define _enable_std_make_unique -# endif -# endif +//Detects the feature std::make_unique +//std::make_unique has been provided by Visual C++ 2013 and later +#undef _enable_std_make_unique +#if (defined(__clang__) && (__cplusplus < 201305L || (__cplusplus == 201305L && (__clang_major__ * 100 + __clang_minor__ < 304 )))) \ + || ((!defined(__clang__)) && defined(__GNUC__) && __cplusplus < 201300L) +# define _enable_std_make_unique #endif + //Detects the feature std::clamp //Visual C++ 2017 with /std:c++latest provides the std::clamp -#if !defined(_MSVC_LANG) || (_MSVC_LANG < 201403L) - -// std::clamp's feature test macro is defined inside -// But nana still avoids introducing on MSVC. -# ifndef _MSC_VER -# include -# endif - -# if ((!defined(__cpp_lib_clamp)) || (__cpp_lib_clamp < 201603)) && (!defined(_enable_std_clamp)) -# define _enable_std_clamp -# endif +#undef _enable_std_clamp +#if (defined(_MSC_VER) && ((!defined(_MSVC_LANG)) || _MSVC_LANG < 201403L)) \ + || (defined(__clang__) && (__cplusplus < 201406L)) \ + || (defined(__GNUC__) && (!defined(__clang__)) && (__cplusplus < 201703)) +# define _enable_std_clamp #endif diff --git a/source/stdc++.cpp b/source/stdc++.cpp index 3796cba8..593ec334 100644 --- a/source/stdc++.cpp +++ b/source/stdc++.cpp @@ -15,6 +15,8 @@ //Implement workarounds for GCC/MinGW which version is below 4.8.2 #if defined(STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED) #include +#include +#include namespace std { int stoi(const std::string& str, std::size_t * pos, int base) @@ -449,14 +451,14 @@ namespace std //{ // unsigned sz = 200; // std::wstring str(sz, L'\0'); - // sz = std::wcsftime(&str[0], str.size() - 1, fmt, tmb); + // sz = std::wcsftime(&str[0], str.size() - 1, fmt, tmb); // str.resize(sz); // return str; //} // http://en.cppreference.com/w/cpp/chrono/c/wcsftime // Defined in header // std::size_t wcsftime(wchar_t* str, std::size_t count, const wchar_t* format, const std::tm* time); - // Converts the date and time information from a given calendar time time to a null - terminated + // Converts the date and time information from a given calendar time time to a null - terminated // wide character string str according to format string format.Up to count bytes are written. // Parameters // str - pointer to the first element of the wchar_t array for output @@ -464,4 +466,4 @@ namespace std // format - pointer to a null - terminated wide character string specifying the format of conversion. } -#endif // _enable_std_put_time \ No newline at end of file +#endif // _enable_std_put_time