@@ -320,6 +320,14 @@ template <class Reducer> class combiner {
320
320
ReduVarPtr, [](auto &&Ref, auto Val) { return Ref.fetch_max (Val); });
321
321
}
322
322
};
323
+
324
+ template <typename T, class BinaryOperation , int Dims> class reducer_common {
325
+ public:
326
+ using value_type = T;
327
+ using binary_operation = BinaryOperation;
328
+ static constexpr int dimensions = Dims;
329
+ };
330
+
323
331
} // namespace detail
324
332
325
333
// / Specialization of the generic class 'reducer'. It is used for reductions
@@ -336,7 +344,8 @@ class reducer<
336
344
reducer<T, BinaryOperation, Dims, Extent, View,
337
345
std::enable_if_t <
338
346
Dims == 0 && Extent == 1 && View == false &&
339
- !detail::IsKnownIdentityOp<T, BinaryOperation>::value>>> {
347
+ !detail::IsKnownIdentityOp<T, BinaryOperation>::value>>>,
348
+ public detail::reducer_common<T, BinaryOperation, Dims> {
340
349
public:
341
350
reducer (const T &Identity, BinaryOperation BOp)
342
351
: MValue(Identity), MIdentity(Identity), MBinaryOp(BOp) {}
@@ -371,7 +380,8 @@ class reducer<
371
380
reducer<T, BinaryOperation, Dims, Extent, View,
372
381
std::enable_if_t <
373
382
Dims == 0 && Extent == 1 && View == false &&
374
- detail::IsKnownIdentityOp<T, BinaryOperation>::value>>> {
383
+ detail::IsKnownIdentityOp<T, BinaryOperation>::value>>>,
384
+ public detail::reducer_common<T, BinaryOperation, Dims> {
375
385
public:
376
386
reducer () : MValue(getIdentity()) {}
377
387
reducer (const T & /* Identity */ , BinaryOperation) : MValue(getIdentity()) {}
@@ -398,7 +408,8 @@ class reducer<T, BinaryOperation, Dims, Extent, View,
398
408
std::enable_if_t <Dims == 0 && View == true >>
399
409
: public detail::combiner<
400
410
reducer<T, BinaryOperation, Dims, Extent, View,
401
- std::enable_if_t <Dims == 0 && View == true >>> {
411
+ std::enable_if_t <Dims == 0 && View == true >>>,
412
+ public detail::reducer_common<T, BinaryOperation, Dims> {
402
413
public:
403
414
reducer (T &Ref, BinaryOperation BOp) : MElement(Ref), MBinaryOp(BOp) {}
404
415
@@ -423,7 +434,8 @@ class reducer<
423
434
reducer<T, BinaryOperation, Dims, Extent, View,
424
435
std::enable_if_t <
425
436
Dims == 1 && View == false &&
426
- !detail::IsKnownIdentityOp<T, BinaryOperation>::value>>> {
437
+ !detail::IsKnownIdentityOp<T, BinaryOperation>::value>>>,
438
+ public detail::reducer_common<T, BinaryOperation, Dims> {
427
439
public:
428
440
reducer (const T &Identity, BinaryOperation BOp)
429
441
: MValue(Identity), MIdentity(Identity), MBinaryOp(BOp) {}
@@ -453,7 +465,8 @@ class reducer<
453
465
reducer<T, BinaryOperation, Dims, Extent, View,
454
466
std::enable_if_t <
455
467
Dims == 1 && View == false &&
456
- detail::IsKnownIdentityOp<T, BinaryOperation>::value>>> {
468
+ detail::IsKnownIdentityOp<T, BinaryOperation>::value>>>,
469
+ public detail::reducer_common<T, BinaryOperation, Dims> {
457
470
public:
458
471
reducer () : MValue(getIdentity()) {}
459
472
reducer (const T & /* Identity */ , BinaryOperation) : MValue(getIdentity()) {}
0 commit comments