STL
STL copied to clipboard
LWG-4053 Unary call to `std::views::repeat` does not decay the argument
LWG-4053 Unary call to std::views::repeat does not decay the argument
Is this simple patch in <ranges> enough to fix this issue?
-template <class _Ty, class _Bo>
-repeat_view(_Ty, _Bo) -> repeat_view<_Ty, _Bo>;
+template <class _Ty, class _Bo = unreachable_sentinel_t>
+repeat_view(_Ty, _Bo = _Bo()) -> repeat_view<_Ty, _Bo>;
Is this simple patch in
<ranges>enough to fix this issue?-template <class _Ty, class _Bo> -repeat_view(_Ty, _Bo) -> repeat_view<_Ty, _Bo>; +template <class _Ty, class _Bo = unreachable_sentinel_t> +repeat_view(_Ty, _Bo = _Bo()) -> repeat_view<_Ty, _Bo>;
Yes. But IIUC the resolution of LWG-4053 is only meaningful when using class template argument deduction, because LWG-4054 covers the major concern. It seems that we should test CTAD of repeat_view (test coverage is nearly completely missing), although it's not recommended for user codes to use CTAD with range adaptors.
We talked about this at the weekly maintainer meeting and @barcharcraz and I agree that this LWG issue resolution is simple enough that we can just directly implement it, no specific testing needed.