From 735de4f0325bc46ecb93a52257f88cbc7f131ecf Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sun, 2 Jul 2017 22:58:31 +0800 Subject: [PATCH] fix logical error on detecting std::clamp feature --- include/nana/c++defines.hpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index 7782e305..a849dfaa 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -112,10 +112,6 @@ # define STD_CODECVT_NOT_SUPPORTED # endif // _MSC_VER == 1900 -# if (_MSC_VER < 1910) //VS2017 RTM -# define _enable_std_clamp -# endif - #elif defined(__clang__) //Clang #include //Introduces some implement-specific flags of ISO C++ Library @@ -195,13 +191,19 @@ # endif #endif -#ifndef _MSC_VER -// std::clamp's feature test macro is defined inside -# include -# if (!defined(__cpp_lib_clamp)) || (__cpp_lib_clamp < 201603) -# ifndef _enable_std_clamp -# define _enable_std_clamp -# 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 #endif