[libcxx-commits] [libcxx] [libc++][ranges] Mark LWG3664 as resolved (PR #210550)
Lucas Mellone via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jul 18 14:32:42 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:
Question about this:
The implementation in the standard is the same as above (https://eel.is/c++draft/range.iter.op.distance), but in the LWG3664 proposal it is:
```suggestion
return __last - static_cast<decay_t<_Ip>&>(__first);
```
Which one should prevail in the scope of this PR?
https://github.com/llvm/llvm-project/pull/210550
More information about the libcxx-commits
mailing list