Binding is the act of tying together a function to
some arguments for deferred (lazy) evaluation. Named Lazy
functions require a bit of typing. Unlike (unnamed) lambda expressions,
we need to write a functor somewhere offline, detached from the call site.
If you wish to transform a plain function, member function or member variable
to a lambda expression, bind
is your friend.
![]() |
Note |
|---|---|
Take note that binders are monomorphic. Rather than binding functions, the preferred way is to write true generic and polymorphic lazy-functions. However, since most of the time we are dealing with adaptation of existing code, binders get the job done faster. |
There is a set of overloaded bind
template functions. Each bind(x)
function generates a suitable binder object, a composite.