On Thu, Feb 16, 2012 at 2:03 PM,  <lars.kn...@nokia.com> wrote:
> On 2/16/12 12:16 PM, "ext Giuseppe D'Angelo" <dange...@gmail.com> wrote:
>
>>On 15 February 2012 22:56, Sean Harmer <s...@theharmers.co.uk> wrote:
>>> Why not make these classes into templates and have typedefs for the
>>> float and double cases? It always confused me why QVector<n>D mixed
>>> qreals and floats.
>>
>>I agree, although typedefs will unfortunately break all forward
>>declarations...
>
> That would break quite a bit of code, so I'm against it.
>
> It's not a big deal to simply add the QRectD, etc. types if required.

You could use inheritance:

struct QRectD: public QRectT<double>
{
    ...forwarding constructors...
};

For the forwarding constructors you could either write them out
manually, which is a chore (but considerably less than doing it for
the whole class), or write template constructors for each arity at the
price of worse error messages. Possibly you could automate the whole
thing with a macro. The problem you can run into is that QList<
QRectT<double> > and QList<QRectD> would no longer be compatible, I'm
not sure if there are others.
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to