Merge fixes from menuet, dropping max() macro workaround.

Conflicts:
	include/string_span.h
This commit is contained in:
Neil MacIntosh 2015-12-14 11:38:20 -08:00
commit 9e1402dff8
2 changed files with 14 additions and 11 deletions

View File

@ -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)

View File

@ -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