summaryrefslogtreecommitdiff
path: root/src/plugins/qmljseditor/qmljsfindreferences.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-05-31 11:31:59 +0200
committerEike Ziller <eike.ziller@qt.io>2018-06-05 12:04:59 +0000
commitf8e88e8ce45a462f27d274c654e31a67032da757 (patch)
treeafc9e80462531ba4852db36533a1787bbf966a1b /src/plugins/qmljseditor/qmljsfindreferences.cpp
parent8798990fb1fad04dca8337479e22d17c1fcbfebd (diff)
downloadqt-creator-f8e88e8ce45a462f27d274c654e31a67032da757.tar.gz
Fix compilation issues with C++17
Testable on Linux/macOS by changing c++14 to c++1z in qtcreator.pri. Testable with latest MSVC2017 by setting _CL_=/std:c++17. unary_function, binary_function, and a few other things that were deprecated are removed in C++17. std::string got a non-const overload for its "data" member function, so we cannot create a function pointer on it without specifying its type. Use std::declval instead (though it requires a default constructor for the type). MSVC seems to have an issue with Utils::transform for std::vector (used in Nim plugin), but that looks like a compiler issue. Change-Id: I94f9a93d591d55b610f86fabfc618158927d6221 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/qmljseditor/qmljsfindreferences.cpp')
-rw-r--r--src/plugins/qmljseditor/qmljsfindreferences.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp
index 7806d9c385..af2750de0c 100644
--- a/src/plugins/qmljseditor/qmljsfindreferences.cpp
+++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp
@@ -683,7 +683,7 @@ static QString matchingLine(unsigned position, const QString &source)
return source.mid(start, end - start);
}
-class ProcessFile: public std::unary_function<QString, QList<FindReferences::Usage> >
+class ProcessFile
{
ContextPtr context;
typedef FindReferences::Usage Usage;
@@ -692,6 +692,10 @@ class ProcessFile: public std::unary_function<QString, QList<FindReferences::Usa
QFutureInterface<Usage> *future;
public:
+ // needed by QtConcurrent
+ using argument_type = const QString &;
+ using result_type = QList<Usage>;
+
ProcessFile(const ContextPtr &context,
QString name,
const ObjectValue *scope,
@@ -721,7 +725,7 @@ public:
}
};
-class SearchFileForType: public std::unary_function<QString, QList<FindReferences::Usage> >
+class SearchFileForType
{
ContextPtr context;
typedef FindReferences::Usage Usage;
@@ -730,6 +734,10 @@ class SearchFileForType: public std::unary_function<QString, QList<FindReference
QFutureInterface<Usage> *future;
public:
+ // needed by QtConcurrent
+ using argument_type = const QString &;
+ using result_type = QList<Usage>;
+
SearchFileForType(const ContextPtr &context,
QString name,
const ObjectValue *scope,
@@ -759,12 +767,17 @@ public:
}
};
-class UpdateUI: public std::binary_function<QList<FindReferences::Usage> &, QList<FindReferences::Usage>, void>
+class UpdateUI
{
typedef FindReferences::Usage Usage;
QFutureInterface<Usage> *future;
public:
+ // needed by QtConcurrent
+ using first_argument_type = QList<Usage> &;
+ using second_argument_type = const QList<Usage> &;
+ using result_type = void;
+
UpdateUI(QFutureInterface<Usage> *future): future(future) {}
void operator()(QList<Usage> &, const QList<Usage> &usages)