DOCUMENTATION

Functors
(ply-system.h)

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.

template <typename T> Functor::Functor(const T& callable)

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

explicit Functor::operator bool() const

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

Return Functor::operator()(CallArgs&& args) const

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

Functor<int(int, int)> add = [](int a, int b) { return a + b; };
add(1, 2);  // Returns 3.