From 2ccf36b4b9bb0311c38947fa7accaf7661d13013 Mon Sep 17 00:00:00 2001 From: Werner Henze Date: Wed, 14 Oct 2020 14:53:43 +0200 Subject: [PATCH 1/3] eliminate warning, use narrow_cast instead of static_cast --- include/gsl/span | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/gsl/span b/include/gsl/span index a649cea..6015d85 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -19,6 +19,7 @@ #include // for Expects #include // for byte +#include // for narrow_cast #include // for array #include // for ptrdiff_t, size_t, nullptr_t @@ -433,14 +434,14 @@ public: template = 0> constexpr explicit span(pointer firstElem, pointer lastElem) noexcept - : storage_(firstElem, static_cast(lastElem - firstElem)) + : storage_(firstElem, gsl::narrow_cast(lastElem - firstElem)) { Expects(lastElem - firstElem == static_cast(Extent)); } template = 0> constexpr span(pointer firstElem, pointer lastElem) noexcept - : storage_(firstElem, static_cast(lastElem - firstElem)) + : storage_(firstElem, gsl::narrow_cast(lastElem - firstElem)) {} template Date: Tue, 20 Oct 2020 00:44:02 +0200 Subject: [PATCH 2/3] Update include/gsl/span Co-authored-by: Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com> --- include/gsl/span | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/gsl/span b/include/gsl/span index 6015d85..c2e0135 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -434,7 +434,7 @@ public: template = 0> constexpr explicit span(pointer firstElem, pointer lastElem) noexcept - : storage_(firstElem, gsl::narrow_cast(lastElem - firstElem)) + : storage_(firstElem, narrow_cast(lastElem - firstElem)) { Expects(lastElem - firstElem == static_cast(Extent)); } From 2af9b11fe90bbfc6c27d48b55c5938124b81534f Mon Sep 17 00:00:00 2001 From: beinhaerter <34543625+beinhaerter@users.noreply.github.com> Date: Tue, 20 Oct 2020 00:44:11 +0200 Subject: [PATCH 3/3] Update include/gsl/span Co-authored-by: Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com> --- include/gsl/span | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/gsl/span b/include/gsl/span index c2e0135..2133baa 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -441,7 +441,7 @@ public: template = 0> constexpr span(pointer firstElem, pointer lastElem) noexcept - : storage_(firstElem, gsl::narrow_cast(lastElem - firstElem)) + : storage_(firstElem, narrow_cast(lastElem - firstElem)) {} template