C++ReactReactive 编程库
C++React 是 C++11 的一个 Reactive 编程库。
示例代码:
using namespace std;
using namespace react;
// Defines a reactive domain that uses single-threaded, sequential updating
REACTIVE_DOMAIN(D, sequential)
// Defines aliases for types of the given domain,
// e.g. using VarSignalT<X> = VarSignal<D,X>
USING_REACTIVE_DOMAIN(D)
// Two reactive variables that can be manipulated imperatively
// to input external changes
VarSignalT<int> width = MakeVar<D>(1);
VarSignalT<int> height = MakeVar<D>(2);
// A signal that depends on width and height and multiplies their values
SignalT<int> area = MakeSignal(
With(width, height),
[] (int w, int h) {
return w * h;
});评论
