diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-04-19 13:58:09 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2011-05-02 12:57:05 (GMT) |
commit | e9d198b5928e1adf678796c098113bc307ef53f5 (patch) | |
tree | 5407b313671b191d3558f309193769d1dee326ee /src/corelib/concurrent | |
parent | 5fc99e9f8e3b24c712d1673d3b55afa8c8090cb4 (diff) | |
download | Qt-e9d198b5928e1adf678796c098113bc307ef53f5.zip Qt-e9d198b5928e1adf678796c098113bc307ef53f5.tar.gz Qt-e9d198b5928e1adf678796c098113bc307ef53f5.tar.bz2 |
get rid of the DisableIfSame hack
By changing the order of the parametters, in a way it is unlikely to clash
Diffstat (limited to 'src/corelib/concurrent')
-rw-r--r-- | src/corelib/concurrent/qtconcurrentfunctionwrappers.h | 12 | ||||
-rw-r--r-- | src/corelib/concurrent/qtconcurrentmap.h | 8 |
2 files changed, 4 insertions, 16 deletions
diff --git a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h index 1c19164..5652609 100644 --- a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h +++ b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h @@ -286,18 +286,6 @@ struct MapResultType<QStringList, U(C::*)() const> typedef QList<U> ResultType; }; -template <typename ReturnType, typename T> -struct DisableIfSame -{ - typedef ReturnType Type; -}; - -template <typename T> -struct DisableIfSame<T, T> -{ - -}; - } // namespace QtPrivate. #endif //qdoc diff --git a/src/corelib/concurrent/qtconcurrentmap.h b/src/corelib/concurrent/qtconcurrentmap.h index 601ab22..a857ab5 100644 --- a/src/corelib/concurrent/qtconcurrentmap.h +++ b/src/corelib/concurrent/qtconcurrentmap.h @@ -206,7 +206,7 @@ void blockingMap(Iterator begin, Iterator end, MapFunctor map) // blockingMappedReduced() for sequences template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor> -typename QtPrivate::DisableIfSame<ResultType, Sequence>::Type blockingMappedReduced(const Sequence &sequence, +ResultType blockingMappedReduced(const Sequence &sequence, MapFunctor map, ReduceFunctor reduce, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) @@ -219,7 +219,7 @@ typename QtPrivate::DisableIfSame<ResultType, Sequence>::Type blockingMappedRedu .startBlocking(); } -template <typename Sequence, typename MapFunctor, typename ReduceFunctor> +template <typename MapFunctor, typename ReduceFunctor, typename Sequence> typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingMappedReduced(const Sequence &sequence, MapFunctor map, ReduceFunctor reduce, @@ -266,7 +266,7 @@ typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingMappedRe // mapped() for sequences with a different putput sequence type. template <typename OutputSequence, typename InputSequence, typename MapFunctor> -typename QtPrivate::DisableIfSame<OutputSequence, InputSequence>::Type blockingMapped(const InputSequence &sequence, MapFunctor map) +OutputSequence blockingMapped(const InputSequence &sequence, MapFunctor map) { return blockingMappedReduced<OutputSequence> (sequence, @@ -275,7 +275,7 @@ typename QtPrivate::DisableIfSame<OutputSequence, InputSequence>::Type blockingM QtConcurrent::OrderedReduce); } -template <typename InputSequence, typename MapFunctor> +template <typename MapFunctor, typename InputSequence> typename QtPrivate::MapResultType<InputSequence, MapFunctor>::ResultType blockingMapped(const InputSequence &sequence, MapFunctor map) { typedef typename QtPrivate::MapResultType<InputSequence, MapFunctor>::ResultType OutputSequence; |