summaryrefslogtreecommitdiffstats
path: root/tests/auto/concurrent/testhelper_functions.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/concurrent/testhelper_functions.h')
-rw-r--r--tests/auto/concurrent/testhelper_functions.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/concurrent/testhelper_functions.h b/tests/auto/concurrent/testhelper_functions.h
index aeba794977..17836cba51 100644
--- a/tests/auto/concurrent/testhelper_functions.h
+++ b/tests/auto/concurrent/testhelper_functions.h
@@ -44,6 +44,19 @@ public:
}
};
+class KeepEvenIntegersMoveOnly
+{
+public:
+ KeepEvenIntegersMoveOnly() = default;
+ KeepEvenIntegersMoveOnly(KeepEvenIntegersMoveOnly &&) = default;
+ KeepEvenIntegersMoveOnly &operator=(KeepEvenIntegersMoveOnly &&other) = default;
+
+ KeepEvenIntegersMoveOnly(const KeepEvenIntegersMoveOnly &) = delete;
+ KeepEvenIntegersMoveOnly &operator=(const KeepEvenIntegersMoveOnly &) = delete;
+
+ bool operator()(int x) { return (x & 1) == 0; }
+};
+
class Number
{
int n;
@@ -121,6 +134,19 @@ public:
}
};
+class IntSumReduceMoveOnly
+{
+public:
+ IntSumReduceMoveOnly() = default;
+ IntSumReduceMoveOnly(IntSumReduceMoveOnly &&) = default;
+ IntSumReduceMoveOnly &operator=(IntSumReduceMoveOnly &&other) = default;
+
+ IntSumReduceMoveOnly(const IntSumReduceMoveOnly &) = delete;
+ IntSumReduceMoveOnly &operator=(const IntSumReduceMoveOnly &) = delete;
+
+ void operator()(int &sum, int x) { sum += x; }
+};
+
void numberSumReduce(int &sum, const Number &x)
{
sum += x.toInt();