[Development] Changing qreal to a float

Thiago Macieira thiago.macieira at intel.com
Tue Feb 21 09:35:23 CET 2012


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120221/f5da82e7/attachment.sig>


More information about the Development mailing list