This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++23 status.
single_view's in place constructor should be explicitSection: 25.6.3.2[range.single.view]Status:C++23Submitter: Tim SongOpened: 2020-04-07Last modified: 2023-11-22
Priority:0
View all otherissues in [range.single.view].
View all issues withC++23 status.
Discussion:
Thein_place_t constructor template ofsingle_view is not explicit:
template<class... Args> requires constructible_from<T, Args...>constexpr single_view(in_place_t, Args&&... args);
so it defines an implicit conversion fromstd::in_place_t tosingle_view<T> wheneverconstructible_from<T> is modeled, which seems unlikely to be the intent.
[2020-04-18 Issue Prioritization]
Status set to Tentatively Ready after six positive votes on the reflector.
[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]
Proposed resolution:
This wording is relative toN4861.
Modify 25.6.3.2[range.single.view] as indicated:
[…]namespace std::ranges { template<copy_constructible T> requires is_object_v<T> class single_view : public view_interface<single_view<T>> { […] public: […] template<class... Args> requires constructible_from<T, Args...> constexprexplicit single_view(in_place_t, Args&&... args); […] };}template<class... Args>constexprexplicit single_view(in_place_t, Args&&... args);-3-Effects: Initializes
value_as if byvalue_{in_place, std::forward<Args>(args)...}.