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

Apply the specified `visitor` to this variant by passing the value (of template parameter `TYPE`) this variant currently holds to the `visitor` object&apos;s `operator()`, and return the value (of template parameter `RET&lowbar;TYPE`) returned by the `visitor`&period; If this variant is unset, the specified `defaultValue` of template parameter `TYPE` is passed to the `visitor`&period; `TYPE` must be the same as one of the types that this variant can hold&period; The behavior is undefined unless this variant is unset or holds a value of template parameter `TYPE`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RET&lowbar;TYPE,
    class VISITOR,
    class TYPE&gt;
RET&lowbar;TYPE
apply(
    VISITOR const& visitor,
    TYPE const& defaultValue) const;
----


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