Title
single_view's in place constructor should be explicit
Status
c++23
Section
[range.single.view]
Submitter
Tim Song

Created on 2020-04-07.00:00:00 last changed 5 months ago

Messages

Date: 2020-11-09.21:40:50

Proposed resolution:

This wording is relative to N4861.

  1. Modify [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)...}.

Date: 2020-11-09.00:00:00

[ 2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP. ]

Date: 2020-04-18.00:00:00

[ 2020-04-18 Issue Prioritization ]

Status set to Tentatively Ready after six positive votes on the reflector.

Date: 2020-04-07.00:00:00

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.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2020-11-09 21:40:50adminsetmessages: + msg11572
2020-11-09 21:40:50adminsetstatus: ready -> wp
2020-04-18 12:24:05adminsetmessages: + msg11224
2020-04-18 12:24:05adminsetstatus: new -> ready
2020-04-11 20:25:14adminsetmessages: + msg11214
2020-04-07 00:00:00admincreate