[#BloombergLP-bslstl-Function_Rep-installFunc]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/Function_Rep.adoc[Function&lowbar;Rep]::installFunc
:relfileprefix: ../../../
:mrdocs:

Install `func` as the target and set the invoker, or leave empty&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FUNC&gt;
void
installFunc(
    FUNC&& func,
    xref:BloombergLP/bslstl/Function_Rep/GenericInvoker.adoc[GenericInvoker] invoker);
----

== Description

Do nothing if the specified `func` is a null pointer, otherwise allocate storage (either in&hyphen;place within this object&apos;s small&hyphen;object buffer or out&hyphen;of&hyphen;place from the allocator) to hold a target of (template parameter) type `FUNC`, forward the `func` to the constructor of the new target, set `d&lowbar;funcManager&lowbar;p` to manage the new target, and set `d&lowbar;invoker&lowbar;p` to the specified `invoker` address&period; The behavior is undefined unless this object is empty on entry&period; Note that `FUNC` will not qualify for the small&hyphen;object optimization unless `bsl&colon;&colon;is&lowbar;nothrow&lowbar;move&lowbar;constructible&lt;FUNC&gt;&colon;&colon;value` is `true`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *func*
| callable object to install as the target
| *invoker*
| invoker function for the installed target
|===


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