proxygen
|
#include <Function.h>
Public Member Functions | |
Function ()=default | |
Function (const Function &)=delete | |
Function (Function &&that) noexcept | |
Function (std::nullptr_t) noexcept | |
template<typename Fun , typename = detail::function::EnableIfNotFunction<Fun>, typename = typename Traits::template ResultOf<Fun>> | |
Function (Fun fun) noexcept(IsSmall< Fun >::value &&noexcept(Fun(std::declval< Fun >()))) | |
template<typename Signature , typename = typename Traits::template ResultOf<Function<Signature>>> | |
Function (Function< Signature > &&that) noexcept(noexcept(Function(std::move(that), CoerceTag{}))) | |
template<typename Member , typename Class , typename = decltype(Function(std::mem_fn((Member Class::*)0)))> | |
Function (Member Class::*ptr) noexcept | |
~Function () | |
Function & | operator= (const Function &)=delete |
Function & | operator= (Function &&that) noexcept |
template<typename Fun , typename = decltype(Function(std::declval<Fun>()))> | |
Function & | operator= (Fun fun) noexcept(noexcept(/*implicit */Function(std::declval< Fun >()))) |
template<typename Signature , typename = typename Traits::template ResultOf<Function<Signature>>> | |
Function & | operator= (Function< Signature > &&that) noexcept(noexcept(Function(std::move(that)))) |
Function & | operator= (std::nullptr_t) noexcept |
template<typename Member , typename Class > | |
auto | operator= (Member Class::*ptr) noexcept-> decltype(operator=(std::mem_fn(ptr))) |
void | swap (Function &that) noexcept |
operator bool () const noexcept | |
bool | hasAllocatedMemory () const noexcept |
SharedProxy | asSharedProxy ()&& |
std::function< typename Traits::NonConstSignature > | asStdFunction ()&& |
Private Types | |
using | Data = detail::function::Data |
using | Op = detail::function::Op |
using | SmallTag = detail::function::SmallTag |
using | HeapTag = detail::function::HeapTag |
using | CoerceTag = detail::function::CoerceTag |
using | Traits = detail::function::FunctionTraits< FunctionType > |
using | Call = typename Traits::Call |
using | Exec = bool(*)(Op, Data *, Data *) |
template<typename Fun > | |
using | IsSmall = detail::function::IsSmall< Fun > |
Private Member Functions | |
bool | exec (Op o, Data *src, Data *dst) const |
template<typename Fun > | |
Function (Fun &&fun, SmallTag) noexcept | |
template<typename Fun > | |
Function (Fun &&fun, HeapTag) | |
template<typename Signature > | |
Function (Function< Signature > &&that, CoerceTag) | |
Function (Function< typename Traits::OtherSignature > &&that, CoerceTag) noexcept | |
Private Attributes | |
Data | data_ {} |
Call | call_ {&Traits::uninitCall} |
Exec | exec_ {nullptr} |
friend | Traits |
Friends | |
class | Function< typename Traits::OtherSignature > |
Function< typename Traits::ConstSignature > | folly::constCastFunction (Function< typename Traits::NonConstSignature > &&) noexcept |
Definition at line 235 of file Function.h.
|
private |
Definition at line 529 of file Function.h.
|
private |
Definition at line 526 of file Function.h.
|
private |
Definition at line 522 of file Function.h.
|
private |
Definition at line 530 of file Function.h.
|
private |
Definition at line 525 of file Function.h.
|
private |
Definition at line 533 of file Function.h.
|
private |
Definition at line 523 of file Function.h.
|
private |
Definition at line 524 of file Function.h.
|
private |
Definition at line 528 of file Function.h.
|
inlineprivatenoexcept |
Definition at line 553 of file Function.h.
|
inlineprivate |
Definition at line 563 of file Function.h.
|
inlineprivate |
Definition at line 571 of file Function.h.
|
inlineprivatenoexcept |
Definition at line 574 of file Function.h.
|
default |
Default constructor. Constructs an empty Function.
|
delete |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Constructs a new Function
from any callable object that is not a folly::Function
. This handles function pointers, pointers to static member functions, std::reference_wrapper
objects, std::function
objects, and arbitrary objects that implement operator()
if the parameter signature matches (i.e. it returns an object convertible to R
when called with Args...
).
typename Traits::template ResultOf<Fun>
prevents this overload from being selected by overload resolution when fun
is not a compatible function.IsSmall
is true when the decayed type fits within the internal buffer and is noexcept-movable. But this ctor might copy, not move. What we need here, if this ctor does a copy, is that this ctor be noexcept when the copy is noexcept. That is not checked in IsSmall
, and shouldn't be, because once the Function
is constructed, the contained object is never copied. This check is for this ctor only, in the case that this ctor does a copy. Definition at line 637 of file Function.h.
|
inlinenoexcept |
For move-constructing from a folly::Function<X(Ys...) [const?]>
. For a Function
with a const
function type, the object must be callable from a const
-reference, i.e. implement operator() const
. For a Function
with a non-const
function type, the object will be called from a non-const reference, which means that it will execute a non-const operator()
if it is defined, and falls back to operator() const
otherwise.
Definition at line 653 of file Function.h.
|
inlinenoexcept |
If ptr
is null, constructs an empty Function
. Otherwise, this constructor is equivalent to Function(std::mem_fn(ptr))
.
Definition at line 667 of file Function.h.
|
inline |
Definition at line 673 of file Function.h.
|
inline |
Move this Function
into a copyable callable object, of which all copies share the state.
Definition at line 801 of file Function.h.
|
inline |
Construct a std::function
by moving in the contents of this Function
. Note that the returned std::function
will share its state (i.e. captured data) across all copies you make of it, so be very careful when copying.
Definition at line 810 of file Function.h.
|
inlineprivate |
Definition at line 543 of file Function.h.
|
inlinenoexcept |
Returns true
if this Function
stores the callable on the heap. If false
is returned, there has been no additional memory allocation and the callable is stored inside the Function
object itself.
Definition at line 791 of file Function.h.
Referenced by TEST().
|
inlineexplicitnoexcept |
Returns true
if this Function
contains a callable, i.e. is non-empty.
Definition at line 781 of file Function.h.
|
delete |
|
inlinenoexcept |
Move assignment operator
that
in a valid but unspecified state. If &that == this
then *this
is left in a valid but unspecified state. Definition at line 695 of file Function.h.
|
inlinenoexcept |
Assigns a callable object to this Function
. If the operation fails, *this
is left unmodified.
typename = decltype(Function(std::declval<Fun>()))
prevents this overload from being selected by overload resolution when fun
is not a compatible function. Definition at line 720 of file Function.h.
|
inlinenoexcept |
For assigning from a Function<X(Ys..) [const?]>
.
Definition at line 741 of file Function.h.
|
inlinenoexcept |
Clears this Function
.
Definition at line 749 of file Function.h.
|
inlinenoexcept |
If ptr
is null, clears this Function
. Otherwise, this assignment operator is equivalent to *this = std::mem_fn(ptr)
.
Definition at line 758 of file Function.h.
|
inlinenoexcept |
Exchanges the callable objects of *this
and that
.
Definition at line 773 of file Function.h.
Referenced by swap_test(), and TEST().
|
friend |
|
friend |
Definition at line 550 of file Function.h.
|
private |
Definition at line 540 of file Function.h.
Referenced by folly::detail::function::FunctionTraits< ReturnType(Args...)>::operator()(), folly::detail::function::FunctionTraits< ReturnType(Args...) const >::operator()(), and folly::detail::function::FunctionTraits< ReturnType(Args...) const >::SharedProxy::operator()().
|
mutableprivate |
Definition at line 539 of file Function.h.
|
private |
Definition at line 541 of file Function.h.
|
private |
Definition at line 547 of file Function.h.