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

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

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FUNC&gt;
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;
----

== Description

Create an object wrapping the specified `func` callable object&period; Use the default allocator to supply memory&period; If `func` is a null pointer or null pointer&hyphen;to&hyphen;member, then the resulting object will be empty&period; This constructor will not participate in overload resolution if `func` is of the same type as (or reference compatible with) this object (to avoid ambiguity with the copy and move constructors) or is an integral type (to avoid matching null pointer literals)&period; In C&plus;&plus;03, this function will not participate in overload resolution if `FUNC` is a `MovableRef` (see overload, below), and instantiation will fail unless `FUNC` is invocable using the arguments and return type specified in `PROTOTYPE`&period; In C&plus;&plus;11 and later, this function will not participate in overload resolution if `FUNC` is not invocable using the arguments and return type specified in `PROTOTYPE`&period; Note that this constructor implicitly converts from any type that is so invocable&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *func*
| callable object to wrap as the target
|===


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