diff --git a/include/gsl/span b/include/gsl/span index 2fb5bbd..7c5b24d 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -25,7 +25,7 @@ #include // for array #include // for ptrdiff_t, size_t, nullptr_t #include // for reverse_iterator, distance, random_access_... -#include // for std::addressof +#include // for std::addressof #include #include // for enable_if_t, declval, is_convertible, inte... #include @@ -475,7 +475,7 @@ public: typename details::calculate_subspan_type::type { Expects((size() >= Offset) && - (Count == dynamic_extent || (Offset + Count <= size()))); + (Count == dynamic_extent || (Count <= size() - Offset))); return {data() + Offset, Count == dynamic_extent ? size() - Offset : Count}; } diff --git a/include/gsl/string_span b/include/gsl/string_span index a1d2bb2..fc0dfeb 100644 --- a/include/gsl/string_span +++ b/include/gsl/string_span @@ -26,7 +26,7 @@ #include // for size_t, nullptr_t #include // for PTRDIFF_MAX #include -#include // for basic_string, allocator, char_traits +#include // for basic_string, allocator, char_traits #include // for declval, is_convertible, enable_if_t, add_... #if defined(_MSC_VER) && !defined(__clang__)