On terça-feira, 21 de fevereiro de 2012 08.24.52, Samuel Rødal wrote:
> Also, I guess we'll want convenience functions "QRectD QRectF::toRectD()
> const" etc. Can that be done with the typedefs proposed above, or does
> it require having "QRectD QRectD::toRectD() const" as well?

With some template magic it can be done.

If you write:
template <class t> class QBasicRect;
typedef QBasicRect<float> QRectF;
typedef QBasicRect<double> QRectD;

Then you can't specialise QBasicRect<float or double> anymore. You can only use
the default expansion or partial specialisations that are yet to be written.
That means it's easier to add an "constexpr inline QRectD toRectD() const;" to
all classes than to just the float and integer ones.

But someone really motivated can add more magic using QEnableIf.

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to