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.

### 3428. `single_view`'s in place constructor should be explicit

Section: 26.6.3.2 [range.single.view] Status: WP Submitter: Tim Song Opened: 2020-04-07 Last modified: 2020-11-09

Priority: 0

View all issues with WP status.

Discussion:

The `in_place_t` constructor template of `single_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 from `std::in_place_t` to `single_view<T>` whenever `constructible_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 to N4861.

1. Modify 26.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...>
   > >         constexpr explicit single_view(in_place_t, Args&&... args);

   > >         […]
   > >       };
   > >     }

   > […]

   >     template<class... Args>
   >     constexpr explicit single_view(in_place_t, Args&&... args);

   > > -3- Effects: Initializes `value_` as if by `value_{in_place, std::forward<Args>(args)...}`.