[#bsl-visitR]
= xref:bsl.adoc[bsl]::visitR
:relfileprefix: ../
:mrdocs:

Return the result of invoking `visitor` with the active alternative of `variant`, converted to `t&lowbar;RET`&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
visitR(
    t&lowbar;VISITOR& visitor,
    t&lowbar;VARIANT&& variant);
----

== Description

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; This function is provided in all language versions for compatibility with the C&plus;&plus;03 version (see below), but in new code in C&plus;&plus;11 and later, `bsl&colon;&colon;visit` should be used instead of this function&period;

== Return Value

result of invoking `visitor`, converted to `t&lowbar;RET`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *visitor*
| callable to invoke on the active alternative
| *variant*
| variant whose active alternative is visited
|===


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