[libcxx-commits] [libcxx] [libc++][ranges] Mark LWG3664 as resolved (PR #210550)

Lucas Mellone via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jul 19 12:06:53 PDT 2026


================
@@ -86,11 +86,11 @@ struct __distance {
   }
 
   template <class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp>
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<decay_t<_Ip>> operator()(_Ip&& __first, _Sp __last) const {
     if constexpr (sized_sentinel_for<_Sp, __remove_cvref_t<_Ip>>) {
       return __last - __first;
     } else {
-      return __last - decay_t<_Ip>(__first);
+      return __last - static_cast<decay_t<_Ip>>(__first);
----------------
lknknm wrote:

Changes were applied conforming the proposal where `iter_difference_t<_Ip>` became `iter_difference_t<decay_t<_Ip>>` and the `static_cast` applied to `return last - static_cast<decay_t<I>>(first);` here in this diff.

https://github.com/llvm/llvm-project/pull/210550


More information about the libcxx-commits mailing list