bsl::holds_alternative

Return true if obj currently holds the t_TYPE alternative.

Synopsis

Declared in <bslstl_variant.h>

template<
    class t_TYPE,
    class t_HEAD,
    class... t_TAIL>
bool
holds_alternative(variant<t_HEAD, t_TAIL...> const& obj) noexcept;

Description

Return true if the specified obj currently holds the (template parameter) t_TYPE alternative, and false otherwise. t_TYPE shall appear exactly once in the variant's list of alternatives.

Return Value

true if obj holds the t_TYPE alternative

Parameters

NameDescription
objvariant to query for the active alternative