[libcxx-commits] [libcxx] [libcxx] applies integer-like changes from [P2393R1] (PR #74161)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 8 18:07:46 PST 2024
================
@@ -38,12 +38,13 @@ namespace ranges::views {
namespace __counted {
struct __fn {
- template<contiguous_iterator _It>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
- noexcept(noexcept(span(std::to_address(__it), static_cast<size_t>(__count))))
- // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly
- { return span(std::to_address(__it), static_cast<size_t>(__count)); }
+ template <contiguous_iterator _It>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept(
+ noexcept(span(std::to_address(__it), static_cast<size_t>(static_cast<iter_difference_t<_It>>(__count)))))
+ // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly
+ {
+ return span(std::to_address(__it), static_cast<size_t>(static_cast<iter_difference_t<_It>>(__count)));
----------------
timsong-cpp wrote:
`static_cast<iter_difference_t<_It>` is a no-op since `__count` is already of that type. The paper adds the cast to `size_t` but the code was already doing that.
https://github.com/llvm/llvm-project/pull/74161
More information about the libcxx-commits
mailing list