[#bsl-function-0a-2constructor-075] = xref:bsl.adoc[bsl]::xref:bsl/function-0a.adoc[function]::function :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<bslstl_function.h>` Create an empty `function` that does not target any callable. [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..._]# Create a `function` with a copy of the target held by `original`. [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..._]# Create an empty `function` that does not target any callable. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/function-0a/2constructor-0b.adoc[function](xref:bsl/nullptr_t-08.adoc[nullptr_t] unused) noexcept; ---- [.small]#xref:bsl/function-0a/2constructor-0b.adoc[_» more..._]# Create a `function` by moving the target from the specified `original`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/function-0a/2constructor-074.adoc[function](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<function>] original) noexcept; ---- [.small]#xref:bsl/function-0a/2constructor-074.adoc[_» more..._]# Create a `function` wrapping the specified `func` callable object. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FUNC> xref:bsl/function-0a/2constructor-03f.adoc[function](FUNC&& func) requires ! IsReferenceCompatible<typename Decay<FUNC>::type, function>::value && IsInvocableWithPrototype< typename Decay<FUNC>::type>::value; ---- [.small]#xref:bsl/function-0a/2constructor-03f.adoc[_» more..._]# Create an empty function using the specified `allocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/function-0a/2constructor-03b1.adoc[function]( std::allocator_arg_t allocatorArg, xref:bsl/function-0a/allocator_type.adoc[allocator_type] const& allocator) noexcept; ---- [.small]#xref:bsl/function-0a/2constructor-03b1.adoc[_» more..._]# Create an empty `function` object using the specified `allocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/function-0a/2constructor-02.adoc[function]( std::allocator_arg_t allocatorArg, xref:bsl/function-0a/allocator_type.adoc[allocator_type] const& allocator, xref:bsl/nullptr_t-08.adoc[nullptr_t] unused) noexcept; ---- [.small]#xref:bsl/function-0a/2constructor-02.adoc[_» more..._]# Create a `function` by moving from `original` using `allocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/function-0a/2constructor-03bb.adoc[function]( std::allocator_arg_t allocatorArg, xref:bsl/function-0a/allocator_type.adoc[allocator_type] const& allocator, xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<function>] original); ---- [.small]#xref:bsl/function-0a/2constructor-03bb.adoc[_» more..._]# Create a `function` copying `original` using the specified `allocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/function-0a/2constructor-0d.adoc[function]( std::allocator_arg_t allocatorArg, xref:bsl/function-0a/allocator_type.adoc[allocator_type] const& allocator, xref:bsl/function-0a.adoc[function] const& original); ---- [.small]#xref:bsl/function-0a/2constructor-0d.adoc[_» more..._]# Create a `function` wrapping `func` using the specified `allocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FUNC> xref:bsl/function-0a/2constructor-0e.adoc[function]( std::allocator_arg_t allocatorArg, xref:bsl/function-0a/allocator_type.adoc[allocator_type] const& allocator, FUNC&& func) requires ! IsReferenceCompatible<typename Decay<FUNC>::type, function>::value && IsInvocableWithPrototype< typename Decay<FUNC>::type>::value; ---- [.small]#xref:bsl/function-0a/2constructor-0e.adoc[_» more..._]# == 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‐argument tag (unused) | *allocator* | allocator used to supply memory |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#