Op 21-2-2012 9:35, Thiago Macieira schreef: > 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. > Just wondering: while I think using templates for these classes is a good idea in principle, will using such template magic as you are suggesting here hurt compilation times, both of Qt itself and Qt applications using these classes?
André _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development