mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Merge fixes from menuet, dropping max() macro workaround.
Conflicts: include/string_span.h
This commit is contained in:
commit
9e1402dff8
@ -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<Span> operator+(typename general_span_iterator<Span>::diff
|
||||
#undef constexpr
|
||||
#pragma pop_macro("constexpr")
|
||||
|
||||
#ifdef _WIN32
|
||||
#undef max
|
||||
#pragma pop_macro("max")
|
||||
#endif
|
||||
|
||||
#if _MSC_VER <= 1800
|
||||
#pragma warning(pop)
|
||||
|
||||
|
@ -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 <typename CharT, std::ptrdiff_t Extent = gsl::dynamic_range, typename T
|
||||
bool operator==(gsl::basic_string_span<CharT, Extent> one, const T& other) noexcept
|
||||
{
|
||||
gsl::basic_string_span<std::add_const_t<CharT>, 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 <typename CharT, std::ptrdiff_t Extent = gsl::dynamic_range, typename T,
|
||||
@ -632,7 +639,13 @@ template <typename CharT, std::ptrdiff_t Extent = gsl::dynamic_range, typename T
|
||||
bool operator==(const T& one, gsl::basic_string_span<CharT, Extent> other) noexcept
|
||||
{
|
||||
gsl::basic_string_span<std::add_const_t<CharT>, 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<CharT, Extent> 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user