@@ -143,45 +143,37 @@ The change propagation is handled implicitly.
143143Depending on the selected concurrency policy, updates can be parallelized:
144144
145145```C++
146- using namespace react;
147-
148-
149146// Sequential updating
150- {
151- REACTIVE_DOMAIN(D, sequential)
152-
153- auto a = MakeVar<D>(1);
154- auto b = MakeVar<D>(2);
155- auto c = MakeVar<D>(3);
147+ REACTIVE_DOMAIN(D, sequential)
156148
157- auto x = (a + b) * c;
149+ VarSignalT<int> a = MakeVar<D>(1);
150+ VarSignalT<int> b = MakeVar<D>(2);
151+ VarSignalT<int> c = MakeVar<D>(3);
158152
159- b <<= 20;
160- }
153+ // Using overloaded arithmetic operators instead of MakeSignal
154+ SignalT<int> x = (a + b) * c;
155+ ```
161156
157+ ``` C++
162158// Parallel updating
163- {
164- REACTIVE_DOMAIN(D, parallel)
159+ REACTIVE_DOMAIN (D, parallel)
165160
166- auto in = MakeVar<D>(0);
161+ VarSignalT< int > in = MakeVar<D >(0);
167162
168- auto op1 = MakeSignal(in, [] (int in)
169- {
170- int result = in /* Costly operation #1 */;
171- return result;
172- };
173-
174- auto op2 = MakeSignal(in, [] (int in)
175- {
176- int result = in /* Costly operation #2 */;
177- return result;
178- };
163+ SignalT<int > op1 = MakeSignal(in, [ ] (int in)
164+ {
165+ int result = doCostlyOperation1(in);
166+ return result;
167+ };
179168
180- auto out = op1 + op2;
169+ SignalT<int > op2 = MakeSignal(in, [ ] (int in)
170+ {
171+ int result = doCostlyOperation2(in);
172+ return result;
173+ };
181174
182- // op1 and op2 can be re-calculated in parallel
183- in <<= 123456789;
184- }
175+ // op1 and op2 can be re-calculated in parallel
176+ SignalT<int > out = op1 + op2;
185177```
186178
187179### More examples
0 commit comments