[#absl-FunctionRef-081]
= xref:absl.adoc[absl]::xref:absl/FunctionRef-0e3.adoc[FunctionRef]&lt;R const(Args&period;&period;&period;)&gt;
:relfileprefix: ../
:mrdocs:

FunctionRef

== Synopsis

Declared in `&lt;absl&sol;functional&sol;function&lowbar;ref&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename R,
    typename&period;&period;&period; Args&gt;
class xref:absl/FunctionRef-0e3.adoc[FunctionRef]&lt;R const(Args&period;&period;&period;)&gt;;
----

== Description

An `absl&colon;&colon;FunctionRef` is a lightweight wrapper to any invocable object with a compatible signature&period; Generally, an `absl&colon;&colon;FunctionRef` should only be used as an argument type and should be preferred as an argument over a const reference to a `std&colon;&colon;function`&period; `absl&colon;&colon;FunctionRef` itself does not allocate, although the wrapped invocable may&period;

Example&colon;

&sol;&sol; The following function takes a function callback by const reference bool Visitor(const std&colon;&colon;function&lt;void(my&lowbar;proto&amp;, absl&colon;&colon;string&lowbar;view)&gt;&amp; callback)&semi;

&sol;&sol; Assuming that the function is not stored or otherwise copied, it can be &sol;&sol; replaced by an `absl&colon;&colon;FunctionRef`&colon; bool Visitor(absl&colon;&colon;FunctionRef&lt;void(my&lowbar;proto&amp;, absl&colon;&colon;string&lowbar;view)&gt; callback)&semi;

== Type Aliases

[cols="1"]
|===
| Name
| xref:absl/FunctionRef-081/absl_internal_is_view.adoc[`absl&lowbar;internal&lowbar;is&lowbar;view`] 
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/FunctionRef-081/2constructor-059.adoc[`FunctionRef`]         [.small]#[constructor]#
| Constructors
| xref:absl/FunctionRef-081/operator_call.adoc[`operator()`] 
| 
|===


== Using Declarations

[cols="1"]
|===
| Name
| xref:absl/FunctionRef-081/operator().adoc[`operator()`] 
|===


== Protected Type Aliases

[cols="1"]
|===
| Name
| xref:absl/FunctionRef-081/EnableIfCompatible.adoc[`EnableIfCompatible`] 
|===


== Protected Member Functions

[cols="1"]
|===
| Name
| xref:absl/FunctionRef-081/2constructor-05d.adoc[`FunctionRef`]         [.small]#[constructor]#
|===



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