This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
3845.ranges::to
's from_range_t
tag branch has the wrong constraint
Section: 25.5.7.2 [range.utility.conv.to] Status: New Submitter: Hewill Kang Opened: 2023-01-06 Last modified: 2024-01-29
Priority: 4
View other active issues in [range.utility.conv.to].
View all other issues in [range.utility.conv.to].
View all issues with New status.
Discussion:
In bullet (1.1.2), ranges::to
checks whether the container type C
models constructible_from<from_range_t, ...>
and constructs it via C(from_range, ...)
.
Since from_range
is a constexpr
variable here, it would be more accurate to constrain C
to be constructible from a const lvalue tag rather than an rvalue tag.
[2023-02-02; Reflector poll]
Set priority to 4 after reflector poll. Several votes for "Tentatively Ready", but also two objections, preferring NAD. The proposed change would appear to bless unconventional uses of from_range
, and we don't want to support or encourage that. The current wording is simpler, and works for the intended cases.
Proposed resolution:
This wording is relative to N4917.
Modify 25.5.7.2 [range.utility.conv.to] as indicated:
template<class C, input_range R, class... Args> requires (!view<C>) constexpr C to(R&& r, Args&&... args);-1- Returns: An object of type
C
constructed from the elements ofr
in the following manner:
(1.1) — If
convertible_to<range_reference_t<R>, range_value_t<C>>
istrue
:
(1.1.1) — If
constructible_from<C, R, Args...>
istrue
:C(std::forward<R>(r), std::forward<Args>(args)...)
(1.1.2) — Otherwise, if
constructible_from<C, constfrom_range_t &, R, Args...>
istrue
:C(from_range, std::forward<R>(r), std::forward<Args>(args)...)
- […]
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