Title
any's in_place constructors
Status
c++17
Section
[any.cons]
Submitter
Ville Voutilainen

Created on 2016-07-10.00:00:00 last changed 82 months ago

Messages

Date: 2016-08-01.18:34:48

Proposed resolution:

This wording is relative to N4606.

  1. Modify [any.cons] as indicated:

    template<class ValueType>
      any(ValueType&& value);
    

    […]

    -7- Requires: T shall satisfy the CopyConstructible requirements. If is_copy_constructible_v<T> is false, the program is ill-formed.

    -8- Effects: Constructs an object of type any that contains an object of type T direct-initialized with std::forward<ValueType>(value).

    -9- Remarks: This constructor shall not participate in overload resolution if decay_t<ValueType> is the same type as any or if ValueType is a specialization of in_place_type_t.

    […]

    template <class T, class... Args>
      explicit any(in_place_type_t<T>, Args&&... args);
    

    -11- Requires: is_constructible_v<T, Args...> is true.

    -?- Remarks: This constructor shall not participate in overload resolution unless is_constructible_v<T, Args...> is true

    […]

    template <class T, class U, class... Args>
      explicit any(in_place_type_t<T>, initializer_list<U> il, Args&&... args);
    

    -15- Requires: is_constructible_v<T, initializer_list<U>&, Args...> is true.

    […]

    -19- Remarks: The functionThis constructor shall not participate in overload resolution unless is_constructible_v<T, initializer_list<U>&, Args...> is true.

Date: 2016-08-01.18:34:48

[ 2016-07 Chicago ]

Monday: P0 - tentatively ready

Date: 2016-07-10.00:00:00

The in_place constructor that takes an initializer_list has both a Requires: for is_constructible and a Remarks: for is_constructible. The one that takes just a pack has just a Requires: for is_constructible.

I think both of those should be Remarks:, i.e. SFINAEable constraints. Otherwise querying is_constructible for an any with in_place_t will not give a reasonable answer, and I utterly fail to see any implementation burden in SFINAEing those constructors.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-11-14 03:59:28adminsetstatus: pending -> wp
2016-11-14 03:55:22adminsetstatus: ready -> pending
2016-08-01 18:34:48adminsetmessages: + msg8282
2016-08-01 18:34:48adminsetstatus: new -> ready
2016-07-24 18:47:31adminsetmessages: + msg8246
2016-07-10 00:00:00admincreate