From cce6ee563eb2047238f57c62afe4e44a5ee8ce8a Mon Sep 17 00:00:00 2001 From: "Jordan Maples [MSFT]" <49793787+JordanMaples@users.noreply.github.com> Date: Mon, 10 Feb 2020 17:09:58 -0800 Subject: [PATCH] address issue with v140 toolset --- include/gsl/span | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/gsl/span b/include/gsl/span index 62591df..6c2b4de 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -71,7 +71,11 @@ namespace gsl { // [views.constants], constants +#if (defined(GSL_USE_STATIC_CONSTEXPR_WORKAROUND)) +constexpr const std::size_t dynamic_extent = static_cast(-1); +#else constexpr std::size_t dynamic_extent = static_cast(-1); +#endif template class span; @@ -134,6 +138,12 @@ namespace details #ifdef _MSC_VER using _Unchecked_type = pointer; #endif + constexpr span_iterator() = default; + + constexpr span_iterator(pointer begin, pointer end, pointer current) + : begin_(begin), end_(end), current_(current) + {} + constexpr operator span_iterator() const noexcept { return {begin_, end_, current_}; @@ -494,6 +504,7 @@ public: template constexpr span first() const noexcept { + Expects(Count != dynamic_extent); Expects(Count <= size()); return {data(), Count}; } @@ -504,6 +515,7 @@ public: // clang-format on constexpr span last() const noexcept { + Expects(Count != dynamic_extent); Expects(size() >= Count); return {data() + (size() - Count), Count}; }