The dominates
type trait
plays a role in modifying the overload set when construction or making an
assingment to variant using the T
&&
(forwarding-reference)
constructor.
dominates
is a predicate
which is used to eliminate a type from the overload set in the case that
a "stronger match" is present, which overload resolution wouldn't
normally eliminate.
dominates
is used to implement
the "priority" for integral types described in the design.
expression |
value |
---|---|
|
any types |
|
|
The default implementation will only returns true
in scenarios in which A,
B, C
are arithmetic types or types which
decay to arithmetic, which means they are arithmetic
types with CV qualifiers and/or references.
template <typename A, typename B, typename C, typename ENABLE = void> struct dominates : std::false_type {}; template <typename A, typename B, typename C> struct dominates<A, B, C, mpl::enable_if_t<decay_to_arithmetic<A>::value && decay_to_arithmetic<B>::value && decay_to_arithmetic<C>::value && !safely_constructible<A, B>::value && safely_constructible<B, A>::value>> : std::true_type {};
See also variant::variant(T &&)
constructor documentation.
Note | |
---|---|
You may specialize
However, it may be best to take care that, for any fixed type |