Return the result of invoking the specified visitor with the currently active alternative of the specified variant, implicitly converting the result to the explicitly specified (template parameter) t_RET. If variant does not hold a value, throw an exception of type bsl::bad_variant_access. Note that unlike the visit overload below that deduces its return type, this overload does not require the visitor to yield the exact same type for each alternative, but only requires each such type to be implicitly convertible to t_RET. 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_RET,
    class t_VISITOR,
    class t_VARIANT>
t_RET
visit(
    t_VISITOR&& visitor,
    t_VARIANT&& variant);

Created with MrDocs