HomeReferenceEvent.h ⇀ Transform

Transform function

Syntax

// (1)
template
<
    typename D,
    typename E,
    typename F,
    typename T = result_of<F(E)>::type
>
TempEvents<D,T,/*unspecified*/>
    Transform(const Events<D,E>& source, F&& func);

// (2)
template
<
    typename D,
    typename E,
    typename F,
    typename T = result_of<F(E)>::type
>
TempEvents<D,T,/*unspecified*/>
    Transform(TempEvents<D,E,/*unspecified*/>&& source, F&& func);

// (3)
template
<
    typename D,
    typename E,
    typename F,
    typename ... TDepValues,
    typename T = result_of<F(E,TDepValues...)>::type
>
Events<D,T> Transform(const Events<D,E>& source,
                      const SignalPack<D,TDepValues...>& depPack, F&& func);

Semantics

For every event e in source, emit t = func(e).

(1) Takes an l-value const reference.

(2) Takes an r-value reference. The linked node is combined with the new node.

(3) Similar to (1), but the synchronized values of signals in depPack are passed to func as additional arguments.

Note: Changes of signals in depPack do not trigger an update - only received events do.

The signature of func should be equivalent to:

Graph

(1)
Drawing

(3)
Drawing