FunctionRef
Declared in <absl/functional/function_ref.h>
template<
typename R,
typename... Args>
class FunctionRef<R const(Args...)>;
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);
| Name |
|---|
absl_internal_is_view |
| Name | Description |
|---|---|
FunctionRef [constructor] | Constructors |
operator() |
| Name |
|---|
operator() |
| Name |
|---|
EnableIfCompatible |
| Name |
|---|
FunctionRef [constructor] |