@@ -238,6 +238,36 @@ class reducer {
238
238
239
239
T getIdentity () const { return MIdentity; }
240
240
241
+ template <typename _T = T>
242
+ enable_if_t <IsReduPlus<_T, BinaryOperation>::value>
243
+ operator +=(const _T &Partial) {
244
+ combine (Partial);
245
+ }
246
+
247
+ template <typename _T = T>
248
+ enable_if_t <IsReduMultiplies<_T, BinaryOperation>::value>
249
+ operator *=(const _T &Partial) {
250
+ combine (Partial);
251
+ }
252
+
253
+ template <typename _T = T>
254
+ enable_if_t <IsReduBitOR<_T, BinaryOperation>::value>
255
+ operator |=(const _T &Partial) {
256
+ combine (Partial);
257
+ }
258
+
259
+ template <typename _T = T>
260
+ enable_if_t <IsReduBitXOR<_T, BinaryOperation>::value>
261
+ operator ^=(const _T &Partial) {
262
+ combine (Partial);
263
+ }
264
+
265
+ template <typename _T = T>
266
+ enable_if_t <IsReduBitAND<_T, BinaryOperation>::value>
267
+ operator &=(const _T &Partial) {
268
+ combine (Partial);
269
+ }
270
+
241
271
T MValue;
242
272
243
273
private:
@@ -281,48 +311,33 @@ class reducer<T, BinaryOperation,
281
311
}
282
312
283
313
template <typename _T = T>
284
- enable_if_t <std::is_same<_T, T>::value &&
285
- IsReduPlus<T, BinaryOperation>::value,
286
- reducer &>
314
+ enable_if_t <IsReduPlus<_T, BinaryOperation>::value>
287
315
operator +=(const _T &Partial) {
288
316
combine (Partial);
289
- return *this ;
290
317
}
291
318
292
319
template <typename _T = T>
293
- enable_if_t <std::is_same<_T, T>::value &&
294
- IsReduMultiplies<T, BinaryOperation>::value,
295
- reducer &>
320
+ enable_if_t <IsReduMultiplies<_T, BinaryOperation>::value>
296
321
operator *=(const _T &Partial) {
297
322
combine (Partial);
298
- return *this ;
299
323
}
300
324
301
325
template <typename _T = T>
302
- enable_if_t <std::is_same<_T, T>::value &&
303
- IsReduBitOR<T, BinaryOperation>::value,
304
- reducer &>
326
+ enable_if_t <IsReduBitOR<_T, BinaryOperation>::value>
305
327
operator |=(const _T &Partial) {
306
328
combine (Partial);
307
- return *this ;
308
329
}
309
330
310
331
template <typename _T = T>
311
- enable_if_t <std::is_same<_T, T>::value &&
312
- IsReduBitXOR<T, BinaryOperation>::value,
313
- reducer &>
332
+ enable_if_t <IsReduBitXOR<_T, BinaryOperation>::value>
314
333
operator ^=(const _T &Partial) {
315
334
combine (Partial);
316
- return *this ;
317
335
}
318
336
319
337
template <typename _T = T>
320
- enable_if_t <std::is_same<_T, T>::value &&
321
- IsReduBitAND<T, BinaryOperation>::value,
322
- reducer &>
338
+ enable_if_t <IsReduBitAND<_T, BinaryOperation>::value>
323
339
operator &=(const _T &Partial) {
324
340
combine (Partial);
325
- return *this ;
326
341
}
327
342
328
343
// / Atomic ADD operation: *ReduVarPtr += MValue;
0 commit comments