@@ -179,46 +179,48 @@ template <class Reducer> class combiner {
179
179
public:
180
180
template <typename _T = Ty, int _Dims = Dims>
181
181
enable_if_t <(_Dims == 0 ) && IsPlus<_T, BinaryOp>::value &&
182
- is_geninteger<_T>::value>
182
+ is_geninteger<_T>::value,
183
+ Reducer &>
183
184
operator ++() {
184
- static_cast <Reducer *>(this )->combine (static_cast <_T>(1 ));
185
+ return static_cast <Reducer *>(this )->combine (static_cast <_T>(1 ));
185
186
}
186
187
187
188
template <typename _T = Ty, int _Dims = Dims>
188
189
enable_if_t <(_Dims == 0 ) && IsPlus<_T, BinaryOp>::value &&
189
- is_geninteger<_T>::value>
190
+ is_geninteger<_T>::value,
191
+ Reducer &>
190
192
operator ++(int ) {
191
- static_cast <Reducer *>(this )->combine (static_cast <_T>(1 ));
193
+ return static_cast <Reducer *>(this )->combine (static_cast <_T>(1 ));
192
194
}
193
195
194
196
template <typename _T = Ty, int _Dims = Dims>
195
- enable_if_t <(_Dims == 0 ) && IsPlus<_T, BinaryOp>::value>
197
+ enable_if_t <(_Dims == 0 ) && IsPlus<_T, BinaryOp>::value, Reducer & >
196
198
operator +=(const _T &Partial) {
197
- static_cast <Reducer *>(this )->combine (Partial);
199
+ return static_cast <Reducer *>(this )->combine (Partial);
198
200
}
199
201
200
202
template <typename _T = Ty, int _Dims = Dims>
201
- enable_if_t <(_Dims == 0 ) && IsMultiplies<_T, BinaryOp>::value>
203
+ enable_if_t <(_Dims == 0 ) && IsMultiplies<_T, BinaryOp>::value, Reducer & >
202
204
operator *=(const _T &Partial) {
203
- static_cast <Reducer *>(this )->combine (Partial);
205
+ return static_cast <Reducer *>(this )->combine (Partial);
204
206
}
205
207
206
208
template <typename _T = Ty, int _Dims = Dims>
207
- enable_if_t <(_Dims == 0 ) && IsBitOR<_T, BinaryOp>::value>
209
+ enable_if_t <(_Dims == 0 ) && IsBitOR<_T, BinaryOp>::value, Reducer & >
208
210
operator |=(const _T &Partial) {
209
- static_cast <Reducer *>(this )->combine (Partial);
211
+ return static_cast <Reducer *>(this )->combine (Partial);
210
212
}
211
213
212
214
template <typename _T = Ty, int _Dims = Dims>
213
- enable_if_t <(_Dims == 0 ) && IsBitXOR<_T, BinaryOp>::value>
215
+ enable_if_t <(_Dims == 0 ) && IsBitXOR<_T, BinaryOp>::value, Reducer & >
214
216
operator ^=(const _T &Partial) {
215
- static_cast <Reducer *>(this )->combine (Partial);
217
+ return static_cast <Reducer *>(this )->combine (Partial);
216
218
}
217
219
218
220
template <typename _T = Ty, int _Dims = Dims>
219
- enable_if_t <(_Dims == 0 ) && IsBitAND<_T, BinaryOp>::value>
221
+ enable_if_t <(_Dims == 0 ) && IsBitAND<_T, BinaryOp>::value, Reducer & >
220
222
operator &=(const _T &Partial) {
221
- static_cast <Reducer *>(this )->combine (Partial);
223
+ return static_cast <Reducer *>(this )->combine (Partial);
222
224
}
223
225
224
226
private:
@@ -339,7 +341,10 @@ class reducer<
339
341
reducer (const T &Identity, BinaryOperation BOp)
340
342
: MValue(Identity), MIdentity(Identity), MBinaryOp(BOp) {}
341
343
342
- void combine (const T &Partial) { MValue = MBinaryOp (MValue, Partial); }
344
+ reducer &combine (const T &Partial) {
345
+ MValue = MBinaryOp (MValue, Partial);
346
+ return *this ;
347
+ }
343
348
344
349
T getIdentity () const { return MIdentity; }
345
350
@@ -371,9 +376,10 @@ class reducer<
371
376
reducer () : MValue(getIdentity()) {}
372
377
reducer (const T & /* Identity */ , BinaryOperation) : MValue(getIdentity()) {}
373
378
374
- void combine (const T &Partial) {
379
+ reducer & combine (const T &Partial) {
375
380
BinaryOperation BOp;
376
381
MValue = BOp (MValue, Partial);
382
+ return *this ;
377
383
}
378
384
379
385
static T getIdentity () {
@@ -396,7 +402,10 @@ class reducer<T, BinaryOperation, Dims, Extent, View,
396
402
public:
397
403
reducer (T &Ref, BinaryOperation BOp) : MElement(Ref), MBinaryOp(BOp) {}
398
404
399
- void combine (const T &Partial) { MElement = MBinaryOp (MElement, Partial); }
405
+ reducer &combine (const T &Partial) {
406
+ MElement = MBinaryOp (MElement, Partial);
407
+ return *this ;
408
+ }
400
409
401
410
private:
402
411
T &MElement;
0 commit comments