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

Return the result of invoking the specified `visitor` with the currently active alternative of the specified `variant`&period; If `variant` does not hold a value, throw an exception of type `bsl&colon;&colon;bad&lowbar;variant&lowbar;access`&period; For each alternative, invocation of the visitor with that alternative shall be of the same type and value category&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;VISITOR,
    class t&lowbar;VARIANT&gt;
bsl::invoke&lowbar;result&lt;t&lowbar;VISITOR&&, decltype(get&lt;0&gt;(BloombergLP&colon;&colon;bslstl&colon;&colon;Variant&lowbar;ImpUtil&colon;&colon;
                    asVariant(std&colon;&colon;forward&lt;t&lowbar;VARIANT&gt;(variant))))&gt;::type
visit(
    t&lowbar;VISITOR&& visitor,
    t&lowbar;VARIANT&& variant);
----


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