From 2ccf36b4b9bb0311c38947fa7accaf7661d13013 Mon Sep 17 00:00:00 2001 From: Werner Henze Date: Wed, 14 Oct 2020 14:53:43 +0200 Subject: [PATCH] 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