qobject.h: remove hack that simulated decltype
In order to know the type of the arguments of a functor with compilers not having decltype, it was simulated with an intermediary function. Now that decltype is mandatory, we can remove this hack Change-Id: I7eb283943abeeb4ef1c62358da89b0ede70b3ef5 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
26eb4b3589
commit
1e30be700a
@ -293,7 +293,7 @@ public:
|
||||
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,
|
||||
Qt::ConnectionType type = Qt::AutoConnection)
|
||||
{
|
||||
#if defined (Q_COMPILER_DECLTYPE) && defined (Q_COMPILER_VARIADIC_TEMPLATES)
|
||||
#if defined (Q_COMPILER_VARIADIC_TEMPLATES)
|
||||
typedef QtPrivate::FunctionPointer<Func1> SignalType;
|
||||
const int FunctorArgumentCount = QtPrivate::ComputeFunctorArgumentCount<Func2 , typename SignalType::Arguments>::Value;
|
||||
|
||||
@ -313,15 +313,7 @@ public:
|
||||
Functors with overloaded or templated operator() are only supported if the compiler supports
|
||||
C++11 variadic templates
|
||||
*/
|
||||
#ifndef Q_COMPILER_DECLTYPE //Workaround the lack of decltype using another function as indirection
|
||||
return connect_functor(sender, signal, context, slot, &Func2::operator(), type); }
|
||||
template <typename Func1, typename Func2, typename Func2Operator>
|
||||
static inline QMetaObject::Connection connect_functor(const QObject *sender, Func1 signal, const QObject *context,
|
||||
Func2 slot, Func2Operator, Qt::ConnectionType type) {
|
||||
typedef QtPrivate::FunctionPointer<Func2Operator> SlotType ;
|
||||
#else
|
||||
typedef QtPrivate::FunctionPointer<decltype(&Func2::operator())> SlotType ;
|
||||
#endif
|
||||
typedef QtPrivate::FunctionPointer<Func1> SignalType;
|
||||
typedef typename SlotType::ReturnType SlotReturnType;
|
||||
const int SlotArgumentCount = SlotType::ArgumentCount;
|
||||
|
@ -593,7 +593,7 @@ namespace QtPrivate {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(Q_COMPILER_DECLTYPE) && defined(Q_COMPILER_VARIADIC_TEMPLATES)
|
||||
#if defined(Q_COMPILER_VARIADIC_TEMPLATES)
|
||||
/*
|
||||
Find the maximum number of arguments a functor object can take and be still compatible with
|
||||
the arguments from the signal.
|
||||
|
Loading…
x
Reference in New Issue
Block a user