* FOLLY_CREATE_MEMBER_INVOKER
Declared in <folly/functional/Invoke.h>
#define FOLLY_CREATE_MEMBER_INVOKER(classname, membername)
Used to create an invoker type bound to a specific member-invocable name.
Example:
FOLLY_CREATE_MEMBER_INVOKER(foo_invoker, foo);
The type foo_invoker is generated in the current namespace and may be used as follows:
struct CanFoo { int foo(Bar&) { return 1; } int foo(Car&&) noexcept { return 2; } };
using traits = folly::invoke_traits<foo_invoker>;
traits::invoke(CanFoo{}, Car{}) // 2
traits::invoke_result<CanFoo, Bar&> // has member traits::invoke_result_t<CanFoo, Bar&> // int traits::invoke_result<CanFoo, Bar&&> // empty traits::invoke_result_t<CanFoo, Bar&&> // error
traits::is_invocable_v<CanFoo, Bar&> // true traits::is_invocable_v<CanFoo, Bar&&> // false
traits::is_invocable_r_v<int, CanFoo, Bar&> // true traits::is_invocable_r_v<char*, CanFoo, Bar&> // false
traits::is_nothrow_invocable_v<CanFoo, Bar&> // false traits::is_nothrow_invocable_v<CanFoo, Car&&> // true
traits::is_nothrow_invocable_v<int, CanFoo, Bar&> // false traits::is_nothrow_invocable_v<char*, CanFoo, Bar&> // false traits::is_nothrow_invocable_v<int, CanFoo, Car&&> // true traits::is_nothrow_invocable_v<char*, CanFoo, Car&&> // false
| Name | Description |
|---|---|
| classname | the name of the generated invoker type |
| membername | the member-invocable name to bind |