BloombergLP::bslstl::Variant_ConvertsWithoutNarrowing

Metafunction that is true_type when t_SOURCE converts to t_DEST without narrowing, and false_type otherwise.

Synopsis

Declared in <bslstl_variant.h>

template<
    class t_DEST,
    class t_SOURCE,
    class = void>
struct Variant_ConvertsWithoutNarrowing
    : bsl::false_type

Base Classes

NameDescription
bsl::false_typeMetafunction representing the boolean constant false.

Specializations

NameDescription
Variant_ConvertsWithoutNarrowing<t_DEST, t_SOURCE, bsl::void_t<decltype(Variant_ArrayHelper<t_DEST>{{std::declval<t_SOURCE>()}})>> This component-private metafunction is derived from bsl::true_type if (template parameter) t_SOURCE can be converted to (template parameter) t_DEST without narrowing, and bsl::false_type otherwise. A conversion from pointer or pointer-to-member type to cv bool is considered narrowing even if the compiler does not implement P1957R2 (which was adopted as a DR); however, on compilers that do not implement P1957R2, we do not have the ability to check whether a user-defined conversion sequence to cv bool would use a narrowing standard conversion, so on those compilers, we permit conversion to a t_DEST that is cv bool only if t_SOURCE is also cv bool, and not when t_SOURCE is a class type. This behavior is not expected to pose a problem for users migrating from bdlb::Variant, because that class does not support implicit conversions from an argument type to an alternative type.