C++React是C++11的一个Reactive编程库。
示例代码:
usig amespace std;usig amespace react;// Defies a reactive domai that uses sigle-threaded, sequetial updatigREACTIVE_DOMAIN(D, sequetial)// Defies aliases for types of the give domai,// e.g. usig VarSigalT<X> = VarSigal<D,X>USING_REACTIVE_DOMAIN(D)// Two reactive variables that ca be maipulated imperatively// to iput exteral chagesVarSigalT<it> width = MakeVar<D>(1);VarSigalT<it> height = MakeVar<D>(2);// A sigal that depeds o width ad height ad multiplies their valuesSigalT<it> area = MakeSigal( With(width, height), [] (it w, it h) { retur w * h; });
评论