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:Tshall satisfy theCopyConstructiblerequirements. Ifis_copy_constructible_v<T>isfalse, the program is ill-formed. -8- Effects: Constructs an object of typeanythat contains an object of typeTdirect-initialized withstd::forward<ValueType>(value). -9- Remarks: This constructor shall not participate in overload resolution ifdecay_t<ValueType>is the same type asanyor ifValueTypeis 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.