[#bsl-function-0a-2constructor-075]
= xref:bsl.adoc[bsl]::xref:bsl/function-0a.adoc[function]::function
:relfileprefix: ../../
:mrdocs:

Constructors

== Synopses

Declared in `&lt;bslstl&lowbar;function&period;h&gt;`

Create an empty `function` that does not target any callable&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/function-0a/2constructor-0a.adoc[function]() noexcept;
----

[.small]#xref:bsl/function-0a/2constructor-0a.adoc[_» more&period;&period;&period;_]#

Create a `function` with a copy of the target held by `original`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/function-0a/2constructor-070.adoc[function](xref:bsl/function-0a.adoc[function] const& original);
----

[.small]#xref:bsl/function-0a/2constructor-070.adoc[_» more&period;&period;&period;_]#

Create an empty `function` that does not target any callable&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/function-0a/2constructor-0b.adoc[function](xref:bsl/nullptr_t-08.adoc[nullptr&lowbar;t] unused) noexcept;
----

[.small]#xref:bsl/function-0a/2constructor-0b.adoc[_» more&period;&period;&period;_]#

Create a `function` by moving the target from the specified `original`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/function-0a/2constructor-074.adoc[function](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;function&gt;] original) noexcept;
----

[.small]#xref:bsl/function-0a/2constructor-074.adoc[_» more&period;&period;&period;_]#

Create a `function` wrapping the specified `func` callable object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FUNC&gt;
xref:bsl/function-0a/2constructor-03f.adoc[function](FUNC&& func)
requires ! IsReferenceCompatible&lt;typename Decay&lt;FUNC&gt;&colon;&colon;type,
                                            function&gt;&colon;&colon;value
                 &amp;&amp;   IsInvocableWithPrototype&lt;
                                             typename Decay&lt;FUNC&gt;&colon;&colon;type&gt;&colon;&colon;value;
----

[.small]#xref:bsl/function-0a/2constructor-03f.adoc[_» more&period;&period;&period;_]#

Create an empty function using the specified `allocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/function-0a/2constructor-03b1.adoc[function](
    std::allocator&lowbar;arg&lowbar;t allocatorArg,
    xref:bsl/function-0a/allocator_type.adoc[allocator&lowbar;type] const& allocator) noexcept;
----

[.small]#xref:bsl/function-0a/2constructor-03b1.adoc[_» more&period;&period;&period;_]#

Create an empty `function` object using the specified `allocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/function-0a/2constructor-02.adoc[function](
    std::allocator&lowbar;arg&lowbar;t allocatorArg,
    xref:bsl/function-0a/allocator_type.adoc[allocator&lowbar;type] const& allocator,
    xref:bsl/nullptr_t-08.adoc[nullptr&lowbar;t] unused) noexcept;
----

[.small]#xref:bsl/function-0a/2constructor-02.adoc[_» more&period;&period;&period;_]#

Create a `function` by moving from `original` using `allocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/function-0a/2constructor-03bb.adoc[function](
    std::allocator&lowbar;arg&lowbar;t allocatorArg,
    xref:bsl/function-0a/allocator_type.adoc[allocator&lowbar;type] const& allocator,
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;function&gt;] original);
----

[.small]#xref:bsl/function-0a/2constructor-03bb.adoc[_» more&period;&period;&period;_]#

Create a `function` copying `original` using the specified `allocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/function-0a/2constructor-0d.adoc[function](
    std::allocator&lowbar;arg&lowbar;t allocatorArg,
    xref:bsl/function-0a/allocator_type.adoc[allocator&lowbar;type] const& allocator,
    xref:bsl/function-0a.adoc[function] const& original);
----

[.small]#xref:bsl/function-0a/2constructor-0d.adoc[_» more&period;&period;&period;_]#

Create a `function` wrapping `func` using the specified `allocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FUNC&gt;
xref:bsl/function-0a/2constructor-0e.adoc[function](
    std::allocator&lowbar;arg&lowbar;t allocatorArg,
    xref:bsl/function-0a/allocator_type.adoc[allocator&lowbar;type] const& allocator,
    FUNC&& func)
requires ! IsReferenceCompatible&lt;typename Decay&lt;FUNC&gt;&colon;&colon;type,
                                            function&gt;&colon;&colon;value
                 &amp;&amp;   IsInvocableWithPrototype&lt;
                                             typename Decay&lt;FUNC&gt;&colon;&colon;type&gt;&colon;&colon;value;
----

[.small]#xref:bsl/function-0a/2constructor-0e.adoc[_» more&period;&period;&period;_]#

== Parameters

[cols="1,4"]
|===
| Name| Description
| *original*
| function whose target is copied
| *unused*
| null pointer literal selecting the empty state
| *func*
| callable object to wrap as the target
| *allocatorArg*
| allocator&hyphen;argument tag (unused)
| *allocator*
| allocator used to supply memory
|===


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