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.
any
's in_place
constructorsSection: 22.7.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
.
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.
Modify 22.7.4.2 [any.cons] as indicated:
template<class ValueType> any(ValueType&& value);[…]
-7- Requires:T
shall satisfy theCopyConstructible
requirements. Ifis_copy_constructible_v<T>
isfalse
, the program is ill-formed. -8- Effects: Constructs an object of typeany
that contains an object of typeT
direct-initialized withstd::forward<ValueType>(value)
. -9- Remarks: This constructor shall not participate in overload resolution ifdecay_t<ValueType>
is the same type asany
or ifValueType
is a specialization ofin_place_type_t
. […]template <class T, class... Args> explicit any(in_place_type_t<T>, Args&&... args);-?- Remarks: This constructor shall not participate in overload resolution unless
-11- Requires:is_constructible_v<T, Args...>
istrue
.is_constructible_v<T, Args...>
istrue
[…]template <class T, class U, class... Args> explicit any(in_place_type_t<T>, initializer_list<U> il, Args&&... args);[…] -19- Remarks:
-15- Requires:is_constructible_v<T, initializer_list<U>&, Args...>
istrue
.The functionThis constructor shall not participate in overload resolution unlessis_constructible_v<T, initializer_list<U>&, Args...>
istrue
.