bsl::visit

Return the result of invoking the specified visitor with the currently active alternative of the specified variant. If variant does not hold a value, throw an exception of type bsl::bad_variant_access. For each alternative, invocation of the visitor with that alternative shall be of the same type and value category. This function differs from the standard in the following ways: * only one variant is supported * constexpr is not implemented * before C++17, only t_VISITOR(ALTERNATIVE) form of visitation is supported; cases where the visitor is a pointer to member are not supported.

Synopsis

Declared in <bslstl_variant.h>

template<
    class t_VISITOR,
    class t_VARIANT>
bsl::invoke_result<t_VISITOR&&, decltype(get<0>(BloombergLP::bslstl::Variant_ImpUtil::
                    asVariant(std::forward<t_VARIANT>(variant))))>::type
visit(
    t_VISITOR&& visitor,
    t_VARIANT&& variant);