mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Disable macro max in Windows. Implement move ctors in string_span for VS2013. Remove redundant pragma warning pop for VS2013.
This commit is contained in:
parent
ace63c5a9d
commit
37cdb6bc50
@ -45,6 +45,12 @@
|
|||||||
#pragma push_macro("constexpr")
|
#pragma push_macro("constexpr")
|
||||||
#define 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
|
// VS 2013 workarounds
|
||||||
#if _MSC_VER <= 1800
|
#if _MSC_VER <= 1800
|
||||||
|
|
||||||
@ -2196,6 +2202,11 @@ general_span_iterator<Span> operator+(typename general_span_iterator<Span>::diff
|
|||||||
#undef constexpr
|
#undef constexpr
|
||||||
#pragma pop_macro("constexpr")
|
#pragma pop_macro("constexpr")
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#undef max
|
||||||
|
#pragma pop_macro("max")
|
||||||
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER <= 1800
|
#if _MSC_VER <= 1800
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
|
@ -235,13 +235,28 @@ public:
|
|||||||
constexpr basic_string_span(const basic_string_span& other) = default;
|
constexpr basic_string_span(const basic_string_span& other) = default;
|
||||||
|
|
||||||
// move
|
// move
|
||||||
|
#ifdef GSL_MSVC_NO_SUPPORT_FOR_MOVE_CTOR_DEFAULT
|
||||||
|
constexpr basic_string_span(basic_string_span&& other)
|
||||||
|
: span_(std::move(other.span_))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#else
|
||||||
constexpr basic_string_span(basic_string_span&& other) = default;
|
constexpr basic_string_span(basic_string_span&& other) = default;
|
||||||
|
#endif
|
||||||
|
|
||||||
// assign
|
// assign
|
||||||
constexpr basic_string_span& operator=(const basic_string_span& other) = default;
|
constexpr basic_string_span& operator=(const basic_string_span& other) = default;
|
||||||
|
|
||||||
// move assign
|
// move assign
|
||||||
|
#ifdef GSL_MSVC_NO_SUPPORT_FOR_MOVE_CTOR_DEFAULT
|
||||||
|
constexpr basic_string_span& operator=(basic_string_span&& other)
|
||||||
|
{
|
||||||
|
span_ = std::move(other.span_);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#else
|
||||||
constexpr basic_string_span& operator=(basic_string_span&& other) = default;
|
constexpr basic_string_span& operator=(basic_string_span&& other) = default;
|
||||||
|
#endif
|
||||||
|
|
||||||
// from nullptr and length
|
// from nullptr and length
|
||||||
constexpr basic_string_span(std::nullptr_t ptr, size_type length) noexcept
|
constexpr basic_string_span(std::nullptr_t ptr, size_type length) noexcept
|
||||||
@ -561,8 +576,6 @@ bool operator>=(const gsl::basic_string_span<CharT, Extent>& one, const gsl::bas
|
|||||||
|
|
||||||
#if _MSC_VER <= 1800
|
#if _MSC_VER <= 1800
|
||||||
|
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
#ifndef GSL_THROW_ON_CONTRACT_VIOLATION
|
#ifndef GSL_THROW_ON_CONTRACT_VIOLATION
|
||||||
#undef noexcept
|
#undef noexcept
|
||||||
#pragma pop_macro("noexcept")
|
#pragma pop_macro("noexcept")
|
||||||
|
Loading…
Reference in New Issue
Block a user