diff --git a/include/span.h b/include/span.h index f8b9015..72d55d6 100644 --- a/include/span.h +++ b/include/span.h @@ -45,12 +45,6 @@ #pragma push_macro("constexpr") #define constexpr -// On Windows, if NOMINMAX is not defined, then windows.h defines the macro max -#ifdef _WIN32 -#pragma push_macro("max") -#define max max -#endif - // VS 2013 workarounds #if _MSC_VER <= 1800 @@ -2202,11 +2196,6 @@ general_span_iterator operator+(typename general_span_iterator::diff #undef constexpr #pragma pop_macro("constexpr") -#ifdef _WIN32 -#undef max -#pragma pop_macro("max") -#endif - #if _MSC_VER <= 1800 #pragma warning(pop) diff --git a/include/string_span.h b/include/string_span.h index b406d2a..44a3f56 100644 --- a/include/string_span.h +++ b/include/string_span.h @@ -35,6 +35,7 @@ #define GSL_MSVC_HAS_TYPE_DEDUCTION_BUG #define GSL_MSVC2013_ICE_WHEN_USING_DUMMY_TEMPLATE_PARAMETER +#define GSL_MSVC2013_EQUAL_ALGORITHM_IS_NOT_CPP14 // noexcept is not understood #ifndef GSL_THROW_ON_CONTRACT_VIOLATION @@ -621,7 +622,13 @@ template one, const T& other) noexcept { gsl::basic_string_span, Extent> tmp(other); +#ifdef GSL_MSVC2013_EQUAL_ALGORITHM_IS_NOT_CPP14 + if (std::distance(one.begin(), one.end()) != std::distance(tmp.begin(), tmp.end())) + return false; + return std::equal(one.begin(), one.end(), tmp.begin()); +#else return std::equal(one.begin(), one.end(), tmp.begin(), tmp.end()); +#endif } template other) noexcept { gsl::basic_string_span, Extent> tmp(one); +#ifdef GSL_MSVC2013_EQUAL_ALGORITHM_IS_NOT_CPP14 + if (std::distance(tmp.begin(), tmp.end()) != std::distance(other.begin(), other.end())) + return false; + return std::equal(tmp.begin(), tmp.end(), other.begin()); +#else return std::equal(tmp.begin(), tmp.end(), other.begin(), other.end()); +#endif } #ifndef _MSC_VER @@ -946,6 +959,7 @@ bool operator>=(const T& one, gsl::basic_string_span other) noexc #pragma pop_macro("noexcept") #endif // GSL_THROW_ON_CONTRACT_VIOLATION +#undef GSL_MSVC2013_EQUAL_ALGORITHM_IS_NOT_CPP14 #undef GSL_MSVC2013_ICE_WHEN_USING_DUMMY_TEMPLATE_PARAMETER #undef GSL_MSVC_HAS_TYPE_DEDUCTION_BUG