This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

### 2744. `any`'s `in_place` constructors

Section: 20.8.4.2 [any.cons] Status: C++17 Submitter: Ville Voutilainen Opened: 2016-07-10 Last modified: 2017-07-30

Priority: 0

View all other issues in [any.cons].

View all issues with C++17 status.

Discussion:

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.

[2016-07 Chicago]

Monday: P0 - tentatively ready

Proposed resolution:

This wording is relative to N4606.

1. Modify 20.8.4.2 [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 function This constructor shall not participate in overload resolution unless `is_constructible_v<T, initializer_list<U>&, Args...>` is `true`.