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

`apply` overloads

== Synopses

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

Apply `visitor` to the held value of this modifiable variant&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class VISITOR&gt;
VISITOR::ResultType
xref:BloombergLP/bdlb/VariantImp/apply-0ec.adoc[apply](VISITOR& visitor)
requires Variant&lowbar;ReturnValueHelper&lt;VISITOR&gt;&colon;&colon;value &equals;&equals; 1;
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-0ec.adoc[_» more&period;&period;&period;_]#

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


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

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-073.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held value of this modifiable variant&period;


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

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-034.adoc[_» more&period;&period;&period;_]#

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


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

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-00.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held `TYPE` value of this modifiable variant&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RET&lowbar;TYPE,
    class VISITOR&gt;
RET&lowbar;TYPE
xref:BloombergLP/bdlb/VariantImp/apply-02f.adoc[apply](VISITOR& visitor);
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-02f.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held value and return `RET&lowbar;TYPE`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RET&lowbar;TYPE,
    class VISITOR&gt;
RET&lowbar;TYPE
xref:BloombergLP/bdlb/VariantImp/apply-0f6.adoc[apply](VISITOR& visitor) const;
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-0f6.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, but for a `const` visitor&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RET&lowbar;TYPE,
    class VISITOR&gt;
RET&lowbar;TYPE
xref:BloombergLP/bdlb/VariantImp/apply-062.adoc[apply](VISITOR const& visitor);
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-062.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held value and return `RET&lowbar;TYPE`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RET&lowbar;TYPE,
    class VISITOR&gt;
RET&lowbar;TYPE
xref:BloombergLP/bdlb/VariantImp/apply-0a.adoc[apply](VISITOR const& visitor) const;
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-0a.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held `TYPE` value of this modifiable variant&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VISITOR,
    class TYPE&gt;
VISITOR::ResultType
xref:BloombergLP/bdlb/VariantImp/apply-08.adoc[apply](
    VISITOR& visitor,
    TYPE const& defaultValue)
requires Variant&lowbar;ReturnValueHelper&lt;VISITOR&gt;&colon;&colon;value &equals;&equals; 1;
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-08.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held `TYPE` value of this variant&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VISITOR,
    class TYPE&gt;
VISITOR::ResultType
xref:BloombergLP/bdlb/VariantImp/apply-0e2.adoc[apply](
    VISITOR& visitor,
    TYPE const& defaultValue) const
requires Variant&lowbar;ReturnValueHelper&lt;VISITOR&gt;&colon;&colon;value &equals;&equals; 1;
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-0e2.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held `TYPE` value of this modifiable variant&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VISITOR,
    class TYPE&gt;
VISITOR::ResultType
xref:BloombergLP/bdlb/VariantImp/apply-021.adoc[apply](
    VISITOR const& visitor,
    TYPE const& defaultValue)
requires Variant&lowbar;ReturnValueHelper&lt;VISITOR&gt;&colon;&colon;value &equals;&equals; 1;
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-021.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held `TYPE` value of this variant&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VISITOR,
    class TYPE&gt;
VISITOR::ResultType
xref:BloombergLP/bdlb/VariantImp/apply-075f.adoc[apply](
    VISITOR const& visitor,
    TYPE const& defaultValue) const
requires Variant&lowbar;ReturnValueHelper&lt;VISITOR&gt;&colon;&colon;value &equals;&equals; 1;
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-075f.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held `TYPE` value of this modifiable variant&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RET&lowbar;TYPE,
    class VISITOR,
    class TYPE&gt;
RET&lowbar;TYPE
xref:BloombergLP/bdlb/VariantImp/apply-028.adoc[apply](
    VISITOR& visitor,
    TYPE const& defaultValue);
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-028.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held `TYPE` value of this variant&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RET&lowbar;TYPE,
    class VISITOR,
    class TYPE&gt;
RET&lowbar;TYPE
xref:BloombergLP/bdlb/VariantImp/apply-0e3.adoc[apply](
    VISITOR& visitor,
    TYPE const& defaultValue) const;
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-0e3.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, but for a `const` visitor&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RET&lowbar;TYPE,
    class VISITOR,
    class TYPE&gt;
RET&lowbar;TYPE
xref:BloombergLP/bdlb/VariantImp/apply-0fc.adoc[apply](
    VISITOR const& visitor,
    TYPE const& defaultValue);
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-0fc.adoc[_» more&period;&period;&period;_]#

Apply `visitor` to the held `TYPE` value of this variant&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RET&lowbar;TYPE,
    class VISITOR,
    class TYPE&gt;
RET&lowbar;TYPE
xref:BloombergLP/bdlb/VariantImp/apply-03c.adoc[apply](
    VISITOR const& visitor,
    TYPE const& defaultValue) const;
----

[.small]#xref:BloombergLP/bdlb/VariantImp/apply-03c.adoc[_» more&period;&period;&period;_]#

== Return Value

result of invoking `visitor` on the active alternative

== Parameters

[cols="1,4"]
|===
| Name| Description
| *visitor*
| callable applied to the active alternative
| *defaultValue*
| value passed to `visitor` when this variant is unset
|===


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