[#BloombergLP-bdlb-VariantImp-apply-073]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/VariantImp.adoc[VariantImp]::apply
:relfileprefix: ../../../
:mrdocs:

Apply `visitor` to the held value and return its result&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class VISITOR&gt;
VISITOR::ResultType
apply(VISITOR& visitor) const
requires Variant&lowbar;ReturnValueHelper&lt;VISITOR&gt;&colon;&colon;value &equals;&equals; 1;
----

== Description

If this variant is unset, a default constructed `bslmf&colon;&colon;Nil` is passed to the `visitor`&period; Note that this method is selected only if the template parameter type `VISITOR` defines a `typedef` of `ResultType` in its public interface&period; Also note that this method is defined inline to work around a Windows compiler bug with SFINAE functions&period;

== Return Value

result of invoking `visitor` on the active alternative

== Parameters

[cols="1,4"]
|===
| Name| Description
| *visitor*
| callable applied to the active alternative
|===


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