proxygen
folly::FunctionRef< FunctionType > Class Template Reference

A reference wrapper for callable objects. More...

#include <Function.h>

Detailed Description

template<typename FunctionType>
class folly::FunctionRef< FunctionType >

A reference wrapper for callable objects.

FunctionRef is similar to std::reference_wrapper, but the template parameter is the function signature type rather than the type of the referenced object. A folly::FunctionRef is cheap to construct as it contains only a pointer to the referenced callable and a pointer to a function which invokes the callable.

The user of FunctionRef must be aware of the reference semantics: storing a copy of a FunctionRef is potentially dangerous and should be avoided unless the referenced object definitely outlives the FunctionRef object. Thus any function that accepts a FunctionRef parameter should only use it to invoke the referenced function and not store a copy of it. Knowing that FunctionRef itself has reference semantics, it is generally okay to use it to reference lambdas that capture by reference.

Definition at line 893 of file Function.h.


The documentation for this class was generated from the following file: