FOLLY_INVOKE_MEMBER

* FOLLY_INVOKE_MEMBER

Synopsis

Declared in <folly/functional/Invoke.h>

#define FOLLY_INVOKE_MEMBER(membername)

Description

An invoker expression resulting in an invocable which, when invoked, invokes the member on the object with the given arguments.

Example:

FOLLY_INVOKE_MEMBER(find)(map, key)

Equivalent to:

map.find(key)

But also equivalent to:

std::invoke(FOLLY_INVOKE_MEMBER(find), map, key)

As an implementation detail, the resulting callable uses a lambda. This has two observable consequences. * Since C++17 only, lambda invocations may be marked constexpr. * Since C++20 only, lambda definitions may appear in an unevaluated context, namely, in an operand to decltype, noexcept, sizeof, or typeid.

Parameters

NameDescription
membernamethe member name to invoke on the object