On 19.06.2012 11:28, Thiago Macieira wrote: > On terça-feira, 19 de junho de 2012 10.22.02, Peter Kümmel wrote: >>> Moc can understand template code just fine for the output it produces. The >>> problem is that the meta object format does not allow for signals and >>> slots >>> containing template parameters in their signature. >> >> But moc could not produce code like this, so I would say it is not "just >> fine": > > Let me emphasise what I said: it can read code just fine for the uses that it > makes. It can parse templates up to an extent. It does not parse what it > cannot use anyway. > >> - header: >> >> template<class T> >> struct A : public QObject >> { >> signals: >> void aSignal(T); >> >> public: >> void foo(){...} >> }; >> >> - somewhere: >> A<int> a; >> >> >> - moc file/header: >> >> template<> >> struct A<int> : public QObject >> { >> Q_QOBJECT >> >> signals: >> void aSignal(int); >> >> // simple copy of code in base template >> void foo(){...} >> }; >> >> + the typical moc code >> >> >> >> But for this all source code needs to be scanned, >> not only the headers. > > Or you need to tell moc which instantiations to produce.
Yes, this would make things much simpler. The only big change would be that a moc generated header needs to be included: foo.h: template<class T> struct A : public QObject { ... // only defined for moc Q_QOBJECT_SPECIALISATION(int> }; #include "foo.moc.h" > > Since there is no way of doing that right now, moc cannot instantiate anything > for you. Then we go back to my assertion that moc works fine for the output > that it *can* produce. :-) > > > > > _______________________________________________ > Development mailing list > Development@qt-project.org > http://lists.qt-project.org/mailman/listinfo/development _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development