[Development] Container refactor update

Peter Kümmel syntheticpp at gmx.net
Tue Jun 19 10:22:02 CEST 2012


On 19.06.2012 10:00, Thiago Macieira wrote:
> On terça-feira, 19 de junho de 2012 09.51.32, Peter Kümmel wrote:
>> On 19.06.2012 09:11, Rene Jensen wrote:
>>> Is this crazy talk? I would imagine that given a set of containers like
>>> ... hmm ... QSmartList, QSmartMap, QSmartHash inheriting from QObject
>>> (yes, I know ... moc and templates bla bla - I could live with fixed
>>> key/value-types if that's what it takes - java did before going
>>> parametric),
>>
>> Maybe there's a time moc embeds clang and can 'understand' template code.
>
> 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":

- 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.

Peter





More information about the Development mailing list