summaryrefslogtreecommitdiffstats
path: root/tests/auto/concurrent/qtconcurrentmap/functions.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/concurrent/qtconcurrentmap/functions.h')
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/functions.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/concurrent/qtconcurrentmap/functions.h b/tests/auto/concurrent/qtconcurrentmap/functions.h
index b37ea08716..7c30c256cb 100644
--- a/tests/auto/concurrent/qtconcurrentmap/functions.h
+++ b/tests/auto/concurrent/qtconcurrentmap/functions.h
@@ -28,6 +28,8 @@
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
+#include <vector>
+
bool keepEvenIntegers(const int &x)
{
return (x & 1) == 0;
@@ -133,4 +135,34 @@ public:
}
};
+class MoveOnlyVector
+{
+public:
+ // rule of six
+ MoveOnlyVector() = default;
+ ~MoveOnlyVector() = default;
+ MoveOnlyVector(MoveOnlyVector &&other) = default;
+ MoveOnlyVector &operator=(MoveOnlyVector &&other) = default;
+
+ MoveOnlyVector(const MoveOnlyVector &) = delete;
+ MoveOnlyVector &operator=(const MoveOnlyVector &) = delete;
+
+ // convenience for creation
+ explicit MoveOnlyVector(const std::vector<int> &v) : data(v) { }
+
+ // minimal interface to be usable as a Sequence in QtConcurrent
+ typedef std::vector<int>::const_iterator const_iterator;
+ typedef std::vector<int>::iterator iterator;
+ const_iterator cbegin() const { return data.cbegin(); }
+ const_iterator cend() const { return data.cend(); }
+ iterator begin() { return data.begin(); }
+ iterator end() { return data.end(); }
+ const_iterator begin() const { return data.cbegin(); }
+ const_iterator end() const { return data.cend(); }
+ bool operator==(const MoveOnlyVector &other) const { return data == other.data; }
+
+private:
+ std::vector<int> data;
+};
+
#endif