aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/mapreduce.h
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@theqtcompany.com>2016-02-26 13:23:48 +0100
committerEike Ziller <eike.ziller@theqtcompany.com>2016-02-26 12:57:22 +0000
commit84dd62308c1a7b3260c216201297992b4e31e6e8 (patch)
treee07aa90ae29e93dc98f3b852d2ccfedbf6fafb7e /src/libs/utils/mapreduce.h
parent420e54281c6d95fe8f53c06ef7f6e34b814b4fa5 (diff)
mapReduce: Fix MSVC2013 build
Looks like it is a problem that the void template specialization for dummyReduce didn't have operator(), but the non-specialized one had, so resultType<dummyReduce> failed. It also seems that passing function pointers (to template functions?) morph into function references somewhere, so we need to sprinkle std::decays over the place, which is the right thing anyhow, since they are decay-copied into the thread eventually. Change-Id: I832474d1a6c3ecef55bfac9339d5e18b6ce910cc Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com> Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Diffstat (limited to 'src/libs/utils/mapreduce.h')
-rw-r--r--src/libs/utils/mapreduce.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/libs/utils/mapreduce.h b/src/libs/utils/mapreduce.h
index 1f103d64f6c..4258dc4d860 100644
--- a/src/libs/utils/mapreduce.h
+++ b/src/libs/utils/mapreduce.h
@@ -228,6 +228,7 @@ struct DummyReduce {
};
template <>
struct DummyReduce<void> {
+ void operator()() const { } // needed for resultType<DummyReduce> with MSVC2013
};
template <typename ReduceResult>
@@ -242,7 +243,13 @@ QFuture<ReduceResult>
mapReduce(Iterator begin, Iterator end, const InitFunction &init, const MapFunction &map,
const ReduceFunction &reduce, const CleanUpFunction &cleanup, int size = -1)
{
- return runAsync(Internal::blockingIteratorMapReduce<Iterator, InitFunction, MapFunction, ReduceResult, ReduceFunction, CleanUpFunction>,
+ return runAsync(Internal::blockingIteratorMapReduce<
+ Iterator,
+ typename std::decay<InitFunction>::type,
+ typename std::decay<MapFunction>::type,
+ typename std::decay<ReduceResult>::type,
+ typename std::decay<ReduceFunction>::type,
+ typename std::decay<CleanUpFunction>::type>,
begin, end, init, map, reduce, cleanup, size);
}
@@ -285,7 +292,13 @@ QFuture<ReduceResult>
mapReduce(const Container &container, const InitFunction &init, const MapFunction &map,
const ReduceFunction &reduce, const CleanUpFunction &cleanup)
{
- return runAsync(Internal::blockingContainerMapReduce<Container, InitFunction, MapFunction, ReduceResult, ReduceFunction, CleanUpFunction>,
+ return runAsync(Internal::blockingContainerMapReduce<
+ typename std::decay<Container>::type,
+ typename std::decay<InitFunction>::type,
+ typename std::decay<MapFunction>::type,
+ typename std::decay<ReduceResult>::type,
+ typename std::decay<ReduceFunction>::type,
+ typename std::decay<CleanUpFunction>::type>,
container, init, map, reduce, cleanup);
}
@@ -296,10 +309,10 @@ QFuture<MapResult>
map(const Container &container, const MapFunction &map)
{
return mapReduce(container,
- &Internal::dummyInit<MapResult>,
+ Internal::dummyInit<MapResult>,
map,
Internal::DummyReduce<MapResult>(),
- &Internal::dummyCleanup<MapResult>);
+ Internal::dummyCleanup<MapResult>);
}
} // Utils