Created on 2022-09-25.00:00:00 last changed 20 months ago
Proposed resolution:
This wording is relative to N4917.
Modify [ranges.syn], header <ranges> synopsis, 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 is_object_v<C> && (!view<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 is_object_v<C> && (!view<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 is_object_v<C> && (!view<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 is_object_v<C> && (!view<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:
[…]
[ 2023-03-22 LWG 3847 was approved in Issaquah. Status changed: New → Resolved. ]
[ Issaquah 2023-02-08; LWG ]
This would be resolved by LWG 3847.
[ 2022-09-28; Reflector poll ]
Set priority to 3 after reflector poll. Some suggestions that it should be Mandates: not Constraints:, but no consensus.
It doesn't make sense for the template parameter C of ranges::to be a reference, which allows us to write something like ranges::to<vector<int>&&>(std::move(v)) or ranges::to<const vector<int>&&>(v), we should forbid this.
The proposed resolution constrains the template parameter C to be object type to conform to its description: "The range conversion functions construct an object (usually a container) from a range".History | |||
---|---|---|---|
Date | User | Action | Args |
2023-03-22 12:28:35 | admin | set | messages: + msg13462 |
2023-03-22 12:28:35 | admin | set | status: new -> resolved |
2023-02-08 23:19:55 | admin | set | messages: + msg13296 |
2022-09-28 20:08:32 | admin | set | messages: + msg12831 |
2022-09-25 17:08:29 | admin | set | messages: + msg12817 |
2022-09-25 00:00:00 | admin | create |