With Qt 5.9, we need to include <functional>

Also remove 'using' statements (to be avoided in header files) and
refer to std::xxx instead of lyx:xxx.
This commit is contained in:
Jean-Marc Lasgouttes 2024-11-04 18:25:31 +01:00
parent d86dbf6675
commit 8c43a134fd

View File

@ -16,11 +16,9 @@
#include <QObject> #include <QObject>
#include <QWaitCondition> #include <QWaitCondition>
namespace lyx { #include <functional>
using std::function; namespace lyx {
using std::ref;
using std::bind;
namespace frontend { namespace frontend {
@ -68,25 +66,25 @@ public:
template<class F, class P1> template<class F, class P1>
R call(F f, P1& p1) R call(F f, P1& p1)
{ {
return call(lyx::bind(f, lyx::ref(p1))); return call(std::bind(f, std::ref(p1)));
} }
template<class F, class P1, class P2> template<class F, class P1, class P2>
R call(F f, P1& p1, P2& p2) R call(F f, P1& p1, P2& p2)
{ {
return call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2))); return call(std::bind(f, std::ref(p1), std::ref(p2)));
} }
template<class F, class P1, class P2, class P3> template<class F, class P1, class P2, class P3>
R call(F f, P1& p1, P2& p2, P3& p3) R call(F f, P1& p1, P2& p2, P3& p3)
{ {
return call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3))); return call(std::bind(f, std::ref(p1), std::ref(p2), std::ref(p3)));
} }
template<class F, class P1, class P2, class P3, class P4> template<class F, class P1, class P2, class P3, class P4>
R call(F f, P1& p1, P2& p2, P3& p3, P4& p4) R call(F f, P1& p1, P2& p2, P3& p3, P4& p4)
{ {
return call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3), lyx::ref(p4))); return call(std::bind(f, std::ref(p1), std::ref(p2), std::ref(p3), std::ref(p4)));
} }
/* /*
@ -96,8 +94,8 @@ public:
template<class F, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8> template<class F, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
R call(F f, P1& p1, P2& p2, P3& p3, P4& p4, P5& p5, P6& p6, P7& p7, P8& p8) R call(F f, P1& p1, P2& p2, P3& p3, P4& p4, P5& p5, P6& p6, P7& p7, P8& p8)
{ {
return call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3), lyx::ref(p4), return call(std::bind(f, std::ref(p1), std::ref(p2), std::ref(p3), std::ref(p4),
lyx::ref(p5), lyx::ref(p6), lyx::ref(p7), lyx::ref(p8))); std::ref(p5), std::ref(p6), std::ref(p7), std::ref(p8)));
} }
private: private:
@ -109,7 +107,7 @@ private:
private: private:
R return_value_; R return_value_;
function<R()> func_; std::function<R()> func_;
}; };
@ -131,25 +129,25 @@ public:
template<class F, class P1> template<class F, class P1>
void call(F f, P1& p1) void call(F f, P1& p1)
{ {
call(lyx::bind(f, lyx::ref(p1))); call(std::bind(f, std::ref(p1)));
} }
template<class F, class P1, class P2> template<class F, class P1, class P2>
void call(F f, P1& p1, P2& p2) void call(F f, P1& p1, P2& p2)
{ {
call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2))); call(std::bind(f, std::ref(p1), std::ref(p2)));
} }
template<class F, class P1, class P2, class P3> template<class F, class P1, class P2, class P3>
void call(F f, P1& p1, P2& p2, P3& p3) void call(F f, P1& p1, P2& p2, P3& p3)
{ {
call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3))); call(std::bind(f, std::ref(p1), std::ref(p2), std::ref(p3)));
} }
template<class F, class P1, class P2, class P3, class P4> template<class F, class P1, class P2, class P3, class P4>
void call(F f, P1& p1, P2& p2, P3& p3, P4& p4) void call(F f, P1& p1, P2& p2, P3& p3, P4& p4)
{ {
call(lyx::bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3), lyx::ref(p4))); call(std::bind(f, std::ref(p1), std::ref(p2), std::ref(p3), std::ref(p4)));
} }
/* /*
@ -159,8 +157,8 @@ public:
template<class F, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8> template<class F, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
void call(F f, P1& p1, P2& p2, P3& p3, P4& p4, P5& p5, P6& p6, P7& p7, P8& p8) void call(F f, P1& p1, P2& p2, P3& p3, P4& p4, P5& p5, P6& p6, P7& p7, P8& p8)
{ {
call(bind(f, lyx::ref(p1), lyx::ref(p2), lyx::ref(p3), lyx::ref(p4), lyx::ref(p5), call(bind(f, std::ref(p1), std::ref(p2), std::ref(p3), std::ref(p4), std::ref(p5),
lyx::ref(p6), lyx::ref(p7), lyx::ref(p8))); std::ref(p6), std::ref(p7), std::ref(p8)));
} }
private: private:
@ -171,7 +169,7 @@ private:
} }
private: private:
function<void()> func_; std::function<void()> func_;
}; };