[#bsl-visit-0f]
= xref:bsl.adoc[bsl]::visit
:relfileprefix: ../
:mrdocs:

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&lowbar;RET`&period; If `variant` does not hold a value, throw an exception of type `bsl&colon;&colon;bad&lowbar;variant&lowbar;access`&period; 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&lowbar;RET`&period; This function differs from the standard in the following ways&colon; &ast; only one variant is supported &ast; constexpr is not implemented &ast; before C&plus;&plus;17, only `t&lowbar;VISITOR(ALTERNATIVE)` form of visitation is supported&semi; cases where the visitor is a pointer to member are not supported&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;variant&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class t&lowbar;RET,
    class t&lowbar;VISITOR,
    class t&lowbar;VARIANT&gt;
t&lowbar;RET
visit(
    t&lowbar;VISITOR&& visitor,
    t&lowbar;VARIANT&& variant);
----


[.small]#Created with https://www.mrdocs.com[MrDocs]#
