Created on 2023-01-06.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to N4928.
Modify [range.utility.conv.to] as indicated:
template<class C, input_range R, class... Args> requires (!view<C>) constexpr C to(R&& r, Args&&... args);-?- Mandates: C is a cv-unqualified class type.
-1- Returns: An object of type C constructed from the elements of r in the following manner:
[…]
Modify [range.utility.conv.adaptors] as indicated:
template<class C, class... Args> requires (!view<C>) constexpr auto to(Args&&... args); template<template<class...> class C, class... Args> constexpr auto to(Args&&... args);-?- Mandates: For the first overload, C is a cv-unqualified class type.
-1- Returns: A range adaptor closure object ([range.adaptor.object]) f that is a perfect forwarding call wrapper ([func.require]) with the following properties:
[…]
[ 2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Immediate → WP. ]
[ Issaquah 2023-02-08; LWG ]
Unanimous consent to move to Immediate. This also resolves LWG 3787.
[ 2023-02-02; Jonathan provides improved wording ]
[ 2023-02-01; Reflector poll ]
Set priority to 2 after reflector poll. Just require C to be a cv-unqualified object type.
Previous resolution [SUPERSEDED]:
This wording is relative to N4917.
Modify [ranges.syn] as indicated:
#include <compare> // see [compare.syn] #include <initializer_list> // see [initializer.list.syn] #include <iterator> // see [iterator.synopsis] namespace std::ranges { […] // [range.utility.conv], range conversions template<class C, input_range R, class... Args> requires (!view<remove_cv_t<C>>) constexpr C to(R&& r, Args&&... args); // freestanding template<template<class...> class C, input_range R, class... Args> constexpr auto to(R&& r, Args&&... args); // freestanding template<class C, class... Args> requires (!view<remove_cv_t<C>>) constexpr auto to(Args&&... args); // freestanding template<template<class...> class C, class... Args> constexpr auto to(Args&&... args); // freestanding […] }Modify [range.utility.conv.to] as indicated:
template<class C, input_range R, class... Args> requires (!view<remove_cv_t<C>>) constexpr C to(R&& r, Args&&... args);-1- Returns: An object of type C constructed from the elements of r in the following manner:
[…]Modify [range.utility.conv.adaptors] as indicated:
template<class C, class... Args> requires (!view<remove_cv_t<C>>) constexpr auto to(Args&&... args); template<template<class...> class C, class... Args> constexpr auto to(Args&&... args);-1- Returns: A range adaptor closure object ([range.adaptor.object]) f that is a perfect forwarding call wrapper ([func.require]) with the following properties:
[…]
The intention of ranges::to is to construct a non-view object, which is reflected in its constraint that object type C should not model a view.
The specification allows C to be a const-qualified type which does not satisfy view such as const string_view, making ranges::to return a dangling view. We should ban such cases.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2023-02-13 11:31:32 | admin | set | messages: + msg13393 |
2023-02-13 11:31:32 | admin | set | status: immediate -> wp |
2023-02-08 23:19:55 | admin | set | messages: + msg13297 |
2023-02-08 23:19:55 | admin | set | status: new -> immediate |
2023-02-02 15:32:28 | admin | set | messages: + msg13255 |
2023-02-01 20:48:23 | admin | set | messages: + msg13249 |
2023-01-06 16:23:59 | admin | set | messages: + msg13181 |
2023-01-06 00:00:00 | admin | create |