ae.utils.functor.primitives

Functor primitives.

Functors are objects which are callable. Unlike function pointers or delegates, functors may embed state, and don't require a context pointer.

Function pointers and delegates are functors; their state contains a pointer to the implementation and context.

https://forum.dlang.org/post/qnigarkuxxnqwdernhzv@forum.dlang.org

Members

Functions

valueFunctor
auto valueFunctor(Value value)

Constructs a nullary functor which simply returns a value specified at run-time. Like () => value, but without the closure and indirect call.

valueFunctor
auto valueFunctor()

Constructs a nullary functor which simply returns a value specified at compile-time. Like () => value, but without the indirect call.

Templates

functor
template functor(alias fun, State...)

Constructs a functor with statically-defined behavior (using an alias), with optional state.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <ae@cy.md>