diff --git a/include/string_span.h b/include/string_span.h index 01c56dc..03ef07a 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 @@ -611,7 +612,13 @@ using wzstring_builder = basic_zstring_builder; template bool operator==(const gsl::basic_string_span& one, const gsl::basic_string_span& other) noexcept { +#ifdef GSL_MSVC2013_EQUAL_ALGORITHM_IS_NOT_CPP14 + if (std::distance(one.begin(), one.end()) != std::distance(other.begin(), other.end())) + return false; + return std::equal(one.begin(), one.end(), other.begin()); +#else return std::equal(one.begin(), one.end(), other.begin(), other.end()); +#endif } template @@ -651,6 +658,7 @@ bool operator>=(const gsl::basic_string_span& one, const gsl::bas #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