diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h index 76645e3311a..909f32a609d 100644 --- a/src/libs/utils/algorithm.h +++ b/src/libs/utils/algorithm.h @@ -207,13 +207,6 @@ inserter(QSet &container) return QSetInsertIterator>(container); } -// decay_t is C++14, so provide it here, remove once we require C++14 -template -using decay_t = typename std::decay::type; - -template -using result_of_t = typename std::result_of::type; - // abstraction to treat Container and QStringList similarly template struct ContainerType @@ -226,10 +219,10 @@ template class T_Container, typename T_Type> struct ContainerType> { template class C = T_Container> - using ResultOfTransform = C>>; + using ResultOfTransform = C>>; template - using ResultOfTransformPMF = T_Container>; + using ResultOfTransformPMF = T_Container>; }; // specialization for QStringList @@ -314,10 +307,10 @@ template class C, // result container type typename S> Q_REQUIRED_RESULT auto transform(const SC &container, R (S::*p)() const) - -> C> + -> C> { return TransformImpl< - C>, + C>, SC >::call(container, p); } diff --git a/src/libs/utils/mapreduce.h b/src/libs/utils/mapreduce.h index 607ff5951aa..9f655a5aa0e 100644 --- a/src/libs/utils/mapreduce.h +++ b/src/libs/utils/mapreduce.h @@ -52,7 +52,7 @@ class MapReduceBase : public MapReduceObject protected: static const int MAX_PROGRESS = 1000000; // either const or non-const reference wrapper for items from the iterator - using ItemReferenceWrapper = std::reference_wrapper::type>; + using ItemReferenceWrapper = std::reference_wrapper>; public: MapReduceBase(QFutureInterface futureInterface, ForwardIterator begin, ForwardIterator end, @@ -281,7 +281,7 @@ void blockingIteratorMapReduce(QFutureInterface &futureInterface, mr(futureInterface, begin, end, std::forward(map), state, std::forward(reduce), option, size); mr.exec(); - callWithMaybeFutureInterface::type&> + callWithMaybeFutureInterface&> (futureInterface, std::forward(cleanup), state); } @@ -320,7 +320,7 @@ static void *dummyInit() { return nullptr; } // copies or moves state to member, and then moves it to the result of the call operator template struct StateWrapper { - using StateResult = typename std::decay::type; // State is const& or & for lvalues + using StateResult = std::decay_t; // State is const& or & for lvalues StateWrapper(State &&state) : m_state(std::forward(state)) { } StateResult operator()() { @@ -333,7 +333,7 @@ struct StateWrapper { // copies or moves reduce function to member, calls the reduce function with state and mapped value template struct ReduceWrapper { - using Reduce = typename std::decay::type; + using Reduce = std::decay_t; ReduceWrapper(ReduceFunction &&reduce) : m_reduce(std::forward(reduce)) { } void operator()(QFutureInterface &, StateResult &state, const MapResult &mapResult) { @@ -376,11 +376,11 @@ mapReduce(ForwardIterator begin, ForwardIterator end, InitFunction &&init, MapFu return runAsync(priority, Internal::blockingIteratorMapReduce< ForwardIterator, - typename std::decay::type, - typename std::decay::type, - typename std::decay::type, - typename std::decay::type, - typename std::decay::type>, + std::decay_t, + std::decay_t, + std::decay_t, + std::decay_t, + std::decay_t>, begin, end, std::forward(init), std::forward(map), std::forward(reduce), std::forward(cleanup), option, size); @@ -446,11 +446,12 @@ mapReduce(Container &&container, InitFunction &&init, MapFunction &&map, { return runAsync(priority, Internal::blockingContainerMapReduce< - typename std::decay::type, - typename std::decay::type, - typename std::decay::type, - typename std::decay::type, typename std::decay::type, - typename std::decay::type>, + std::decay_t, + std::decay_t, + std::decay_t, + std::decay_t, + std::decay_t, + std::decay_t>, std::forward(container), std::forward(init), std::forward(map), std::forward(reduce), std::forward(cleanup), @@ -469,11 +470,11 @@ mapReduce(std::reference_wrapper containerWrapper, InitFunction &&ini return runAsync(priority, Internal::blockingContainerRefMapReduce< Container, - typename std::decay::type, - typename std::decay::type, - typename std::decay::type, - typename std::decay::type, - typename std::decay::type>, + std::decay_t, + std::decay_t, + std::decay_t, + std::decay_t, + std::decay_t>, containerWrapper, std::forward(init), std::forward(map), std::forward(reduce), std::forward(cleanup), @@ -481,7 +482,7 @@ mapReduce(std::reference_wrapper containerWrapper, InitFunction &&ini } template ::type, // State = T& or const T& for lvalues, so decay that away + typename StateResult = std::decay_t, // State = T& or const T& for lvalues, so decay that away typename MapResult = typename Internal::resultType::type> QFuture mapReduce(ForwardIterator begin, ForwardIterator end, MapFunction &&map, State &&initialState, @@ -497,7 +498,7 @@ mapReduce(ForwardIterator begin, ForwardIterator end, MapFunction &&map, State & } template ::type, // State = T& or const T& for lvalues, so decay that away + typename StateResult = std::decay_t, // State = T& or const T& for lvalues, so decay that away typename MapResult = typename Internal::resultType::type> QFuture mapReduce(Container &&container, MapFunction &&map, State &&initialState, ReduceFunction &&reduce, @@ -513,7 +514,7 @@ mapReduce(Container &&container, MapFunction &&map, State &&initialState, Reduce } template ::type, // State = T& or const T& for lvalues, so decay that away + typename StateResult = std::decay_t, // State = T& or const T& for lvalues, so decay that away typename MapResult = typename Internal::resultType::type> Q_REQUIRED_RESULT StateResult @@ -528,7 +529,7 @@ mappedReduced(ForwardIterator begin, ForwardIterator end, MapFunction &&map, Sta } template ::type, // State = T& or const T& for lvalues, so decay that away + typename StateResult = std::decay_t, // State = T& or const T& for lvalues, so decay that away typename MapResult = typename Internal::resultType::type> Q_REQUIRED_RESULT StateResult diff --git a/src/libs/utils/runextensions.h b/src/libs/utils/runextensions.h index 0b066b6d8af..75ab84acc39 100644 --- a/src/libs/utils/runextensions.h +++ b/src/libs/utils/runextensions.h @@ -140,7 +140,7 @@ struct resultTypeIsFunctionLike template struct resultTypeHasCallOperator - : public resultTypeIsFunctionLike::type>::type>::value> + : public resultTypeIsFunctionLike>>::value> { }; @@ -257,15 +257,14 @@ void runAsyncQFutureInterfaceDispatch(std::true_type, QFutureInterface void runAsyncQFutureInterfaceDispatch(std::false_type, QFutureInterface futureInterface, Function &&function, Args&&... args) { - runAsyncReturnVoidDispatch(std::is_void::type>(), + runAsyncReturnVoidDispatch(std::is_void>(), futureInterface, std::forward(function), std::forward(args)...); } // function, function pointer, or other callable object that is no member pointer template ::type>::value - >::type> + typename = std::enable_if_t>::value> + > void runAsyncMemberDispatch(QFutureInterface futureInterface, Function &&function, Args&&... args) { runAsyncQFutureInterfaceDispatch(functionTakesArgument&>(), @@ -274,14 +273,13 @@ void runAsyncMemberDispatch(QFutureInterface futureInterface, Functi // Function = member function template ::type>::value - >::type> + typename = std::enable_if_t>::value> + > void runAsyncMemberDispatch(QFutureInterface futureInterface, Function &&function, Obj &&obj, Args&&... args) { // Wrap member function with object into callable runAsyncImpl(futureInterface, - MemberCallable::type>(std::forward(function), std::forward(obj)), + MemberCallable>(std::forward(function), std::forward(obj)), std::forward(args)...); } @@ -315,7 +313,7 @@ template struct makeIndexSequence<0, S...> { typedef indexSequence type; }; template -typename std::decay::type +std::decay_t decayCopy(T&& v) { return std::forward(v); @@ -369,7 +367,7 @@ public: } private: - using Data = std::tuple::type, typename std::decay::type...>; + using Data = std::tuple, std::decay_t...>; template void runHelper(indexSequence) @@ -464,10 +462,10 @@ runAsync(QThread::Priority priority, Function &&function, Args&&... args) \sa QThread::Priority */ template ::type, QThreadPool>::value - && !std::is_same::type, QThread::Priority>::value - >::type, + typename = std::enable_if_t< + !std::is_same, QThreadPool>::value + && !std::is_same, QThread::Priority>::value + >, typename ResultType = typename Internal::resultType::type> QFuture runAsync(Function &&function, Args&&... args) @@ -483,9 +481,7 @@ runAsync(Function &&function, Args&&... args) \sa QThread::Priority */ template ::type, QThread::Priority>::value - >::type, + typename = std::enable_if_t, QThread::Priority>::value>, typename ResultType = typename Internal::resultType::type> QFuture runAsync(QThreadPool *pool, Function &&function, Args&&... args) diff --git a/src/libs/utils/smallstring.h b/src/libs/utils/smallstring.h index e172cbaae60..e47b7720a22 100644 --- a/src/libs/utils/smallstring.h +++ b/src/libs/utils/smallstring.h @@ -107,7 +107,7 @@ public: } template::value>::type + typename = std::enable_if_t::value> > BasicSmallString(Type characterPointer) : BasicSmallString(characterPointer, std::strlen(characterPointer)) @@ -120,15 +120,15 @@ public: {} template::type, std::string>::value>::type> + typename = std::enable_if_t, std::string>::value> + > BasicSmallString(Type &&string) : BasicSmallString(string.data(), string.size()) {} template::value>::type + typename = std::enable_if_t::value> > BasicSmallString(BeginIterator begin, EndIterator end) : BasicSmallString(&(*begin), size_type(end - begin)) @@ -560,7 +560,7 @@ unitttest_public: } template::value>::type + typename = std::enable_if_t::value> > friend bool operator==(const BasicSmallString& first, Type second) noexcept { @@ -568,7 +568,7 @@ unitttest_public: } template::value>::type + typename = std::enable_if_t::value> > friend bool operator==(Type first, const BasicSmallString& second) noexcept { @@ -620,7 +620,7 @@ unitttest_public: } template::value>::type + typename = std::enable_if_t::value> > friend bool operator!=(const BasicSmallString& first, Type second) noexcept { @@ -628,7 +628,7 @@ unitttest_public: } template::value>::type + typename = std::enable_if_t::value> > friend bool operator!=(Type first, const BasicSmallString& second) noexcept { diff --git a/src/libs/utils/smallstringview.h b/src/libs/utils/smallstringview.h index 71d04fe20d2..2d445501c2e 100644 --- a/src/libs/utils/smallstringview.h +++ b/src/libs/utils/smallstringview.h @@ -50,7 +50,7 @@ public: } template::value>::type + typename = std::enable_if_t::value> > SmallStringView(Type characterPointer) noexcept : m_pointer(characterPointer),