diff --git a/include/gsl/span b/include/gsl/span index 6e7e791..52af1f7 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -25,7 +25,6 @@ #include // for array #include // for ptrdiff_t, size_t, nullptr_t #include // for reverse_iterator, distance, random_access_... -#include #include // for std::addressof #include #include // for enable_if_t, declval, is_convertible, inte... @@ -72,7 +71,7 @@ namespace gsl { // [views.constants], constants -constexpr const std::size_t dynamic_extent = std::numeric_limits::max(); +constexpr const std::size_t dynamic_extent = -1; template class span; @@ -476,7 +475,7 @@ public: typename details::calculate_subspan_type::type { Expects((size() >= Offset) && - (Count == dynamic_extent || (Count >= 0 && Offset + Count <= size()))); + (Count == dynamic_extent || (Offset + Count <= size()))); return {data() + Offset, Count == dynamic_extent ? size() - Offset : Count}; } @@ -654,7 +653,7 @@ private: span make_subspan(index_type offset, index_type count, subspan_selector) const { - Expects(offset >= 0 && size() >= offset && size() != dynamic_extent); + Expects(size() >= offset && size() != dynamic_extent); if (count == dynamic_extent) { return {KnownNotNull{data() + offset}, size() - offset}; } diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index ac05af1..8d9fadd 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -30,11 +30,6 @@ #include // for integral_constant<>::value, is_default_co... #include // for vector -namespace gsl -{ -struct fail_fast; -} // namespace gsl - using namespace std; using namespace gsl;