<ply-base.h>
namespace ply
Functors

Functor is a class template that stores arbitrary callback functions taking both explicit and hidden arguments. Often used to store lambda expressions.

It's movable and copyable if the callable is copyable.

Additional Constructors
template <typename T
Functor(const T& callable)
Invocation
explicit operator bool() const
Return operator()(CallArgs&& args) const
template <typename TFunctor(const Tcallable)

Constructs a functor from any callable object. The callable is copied into internal storage.

explicit operator bool() const

Returns true if the functor holds a callable, false if empty.

Return operator()(CallArgs&& args) const

Invokes the wrapped callable with the given arguments and returns its result.

Example
Functor<int(int, int)> add = [](int a, int b) { return a + b; };
int result = add(3, 4);  // result is 7