diff options
author | Chris Robinson <[email protected]> | 2023-01-29 17:18:00 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-01-29 17:18:00 -0800 |
commit | ca39bd7ad788fcf7282019392ede65fe7270e3ae (patch) | |
tree | 5651e8d2659fe7bd5fe26076eb89094f8b3a929e /common/alspan.h | |
parent | d4b5202490abfac64aef76fb070b9ded63a6633a (diff) |
Avoid using to_address on an end iterator
Diffstat (limited to 'common/alspan.h')
-rw-r--r-- | common/alspan.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/common/alspan.h b/common/alspan.h index 428363fe..d1a846ce 100644 --- a/common/alspan.h +++ b/common/alspan.h @@ -108,7 +108,7 @@ public: constexpr span() noexcept { } template<typename U> constexpr explicit span(U iter, index_type) : mData{to_address(iter)} { } - template<typename U, typename V, REQUIRES(!std::is_integral<V>::value)> + template<typename U, typename V, REQUIRES(!std::is_convertible<V,size_t>::value)> constexpr explicit span(U first, V) : mData{to_address(first)} { } constexpr span(type_identity_t<element_type> (&arr)[E]) noexcept @@ -223,9 +223,8 @@ public: constexpr span(U iter, index_type count) : mData{to_address(iter)}, mDataEnd{to_address(iter)+count} { } - template<typename U, typename V, REQUIRES(!std::is_integral<V>::value)> - constexpr span(U first, V last) - : mData{to_address(first)}, mDataEnd{to_address(last)} + template<typename U, typename V, REQUIRES(!std::is_convertible<V,size_t>::value)> + constexpr span(U first, V last) : span{to_address(first), static_cast<size_t>(last-first)} { } template<size_t N> |