narrow_cast instead of static_cast (#1250)
This removes the "warning C26472: Don't use a static_cast for arithmetic conversions. Use brace initialization, gsl::narrow_cast or gsl::narrow (type.1)." issued by VS2026. Co-authored-by: Werner Henze <w.henze@avm.de>
This commit is contained in:
1 parent
0249144ad1
commit
66ca39d9c8
1 file changed
+1
-1
@@ -149,7 +149,7 @@ constexpr ElementType& at(span<ElementType, Extent> s, index i)
|
||||
template <class ElementType, std::size_t Extent>
|
||||
constexpr std::ptrdiff_t ssize(const span<ElementType, Extent>& s) noexcept
|
||||
{
|
||||
return static_cast<std::ptrdiff_t>(s.size());
|
||||
return gsl::narrow_cast<std::ptrdiff_t>(s.size());
|
||||
}
|
||||
|
||||
// [span.iter] Free functions for begin/end functions
|
||||
|
||||
Reference in new issue
Block a user