This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
4053. Unary call tostd::views::repeat
does not decay the argument
Section: 25.6.5.2 [range.repeat.view] Status: WP Submitter: Jiang An Opened: 2024-02-05 Last modified: 2024-04-02
Priority: Not Prioritized
View all other issues in [range.repeat.view].
View all issues with WP status.
Discussion:
Currently, a binary call to std::views::repeat
decay the arguments due to the deduction guide, but a unary call doesn't, which is inconsistent.
#include <concepts> #include <ranges> using RPV = std::ranges::repeat_view<const char*>; static_assert(std::same_as<decltype(std::views::repeat("foo", std::unreachable_sentinel)), RPV>); // OK static_assert(std::same_as<decltype(std::views::repeat(+"foo", std::unreachable_sentinel)), RPV>); // OK static_assert(std::same_as<decltype(std::views::repeat("foo")), RPV>); // ill-formed static_assert(std::same_as<decltype(std::views::repeat(+"foo")), RPV>); // OK
Presumably we should extend the deduction guide of std::ranges::repeat_view
to cover the unary cases.
[2024-03-12; Reflector poll]
Set status to Tentatively Ready after six votes in favour during reflector poll.
[Tokyo 2024-03-23; Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4971.
Modify 25.6.5.2 [range.repeat.view], class template repeat_view
synopsis, as indicated:
[Drafting note: The proposed wording has been suggested by Casey Carter, see microsoft/STL#3576]
namespace std::ranges { […] template<class T, class Bound = unreachable_sentinel_t> repeat_view(T, Bound = Bound()) -> repeat_view<T, Bound>; }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4