<ply-base.h>namespace plyFunctors
<ply-base.h>namespace plyFunctor 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 T> Functor(const T& callable)Constructs a functor from any callable object. The callable is copied into internal storage.
explicit operator bool() constReturns
trueif the functor holds a callable,falseif empty.Return operator()(CallArgs&& args) constInvokes 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