FunctionRef
Synopsis
Declared in <absl/functional/function_ref.h>
template<
typename R,
typename... Args>
class 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
Member Functions
Name |
Description |
|
Constructors |
Using Declarations
Name |
Protected Type Aliases
Name |
Protected Member Functions
Name |
|
Created with MrDocs