[#absl-FunctionRef-081] = xref:absl.adoc[absl]::xref:absl/FunctionRef-0e3.adoc[FunctionRef]<R const(Args...)> :relfileprefix: ../ :mrdocs: FunctionRef == Synopsis Declared in `<absl/functional/function_ref.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename R, typename... Args> class xref:absl/FunctionRef-0e3.adoc[FunctionRef]<R const(Args...)>; ---- == Description An `absl::FunctionRef` is a lightweight wrapper to any invocable object with a compatible signature. Generally, an `absl::FunctionRef` should only be used as an argument type and should be preferred as an argument over a const reference to a `std::function`. `absl::FunctionRef` itself does not allocate, although the wrapped invocable may. Example: // The following function takes a function callback by const reference bool Visitor(const std::function<void(my_proto&, absl::string_view)>& callback); // Assuming that the function is not stored or otherwise copied, it can be // replaced by an `absl::FunctionRef`: bool Visitor(absl::FunctionRef<void(my_proto&, absl::string_view)> callback); == Type Aliases [cols="1"] |=== | Name | xref:absl/FunctionRef-081/absl_internal_is_view.adoc[`absl_internal_is_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]#