| Doc. no.: | P0608R0 |
|---|---|
| Date: | 2017-03-02 |
| Audience: | LEWG, LWG |
| Reply-to: | Zhihao Yuan <zy at miator dot net> |
See LEWG 227.
This wording is relative to N4640.
Modify 20.7.3.1 [variant.ctor]/12 as indicated:
template <class T> constexpr variant(T&& t) noexcept(see below );
In the following sections, let
is_non_narrowing_convertible_vbe an exposition only trait defined as:
template <typename From, typename To>
constexpr bool is_non_narrowing_convertible_v = see below;
is_non_narrowing_convertible_v<From, To> is
trueif is_convertible_v<From, To> istrueand converting a non-constant object ofFromtoTodoes not require a narrowing conversion (8.6.4) or a boolean conversion (4.14), otherwisefalse.
Let
Tj be a type that is determined as follows: build an imaginary functionFUN(Ti)for each alternative typeTi, whereFUN(Ti)shall not participate in overload resolution unless is_non_narrowing_convertible_v<T, Ti> istrue. The overloadFUN(Ti)selected by overload resolution for the expressionFUN(std::forward<T>(t)) defines the alternativeTj which is the type of the contained value after construction.
[…]
Modify 20.7.3.3 [variant.assign]/8 as indicated:
template <class T> variant& operator=(T&& t) noexcept(see below );
Let
Tj be a type that is determined as follows: build an imaginary functionFUN(Ti)for each alternative typeTi, whereFUN(Ti)shall not participate in overload resolution unless is_non_narrowing_convertible_v<T, Ti> istrue. The overloadFUN(Ti)selected by overload resolution for the expressionFUN(std::forward<T>(t)) defines the alternativeTj which is the type of the contained value after assignment.
[…]